improve demo iframes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="demo-page">
|
||||
<demo :name="$context.name" :show-source="false" inline />
|
||||
<demo :name="$context.name" v-bind="props" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -17,6 +17,36 @@ export default {
|
||||
],
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
fromString(value) {
|
||||
if (typeof value !== 'string') {
|
||||
return value
|
||||
}
|
||||
|
||||
if (value.match(/^\d*(\.\d+)?$/)) {
|
||||
return Number(value)
|
||||
}
|
||||
|
||||
if (value === 'true') {
|
||||
return true
|
||||
}
|
||||
|
||||
if (value === 'false') {
|
||||
return false
|
||||
}
|
||||
|
||||
return value
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
props() {
|
||||
return Object.fromEntries(Object
|
||||
.entries(this.$route.query)
|
||||
.map(([key, value]) => [key, this.fromString(value)]))
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user