fix react renderer
This commit is contained in:
@@ -60,9 +60,9 @@ module.exports = function (api) {
|
|||||||
/**
|
/**
|
||||||
* Generate pages for all demo components for testing purposes
|
* Generate pages for all demo components for testing purposes
|
||||||
*/
|
*/
|
||||||
globby.sync('./src/demos/**/index.vue').forEach(file => {
|
globby.sync('./src/demos/**/index.(vue|jsx)').forEach(file => {
|
||||||
const match = file.match(
|
const match = file.match(
|
||||||
new RegExp(/\.\/src\/demos\/([\S]+)\/index.vue/i),
|
new RegExp(/\.\/src\/demos\/([\S]+)\/index.(vue|jsx)/i),
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!match) {
|
if (!match) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="demo-page">
|
<div class="demo-page">
|
||||||
<demo-content :name="$context.name" />
|
<demo-content :name="$context.name" v-bind="props" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -30,6 +30,40 @@ 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
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value === 'null') {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return value
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
props() {
|
||||||
|
return Object.fromEntries(Object
|
||||||
|
.entries(this.$route.query)
|
||||||
|
.map(([key, value]) => [key, this.fromString(value)]))
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.resizeObserver = new window.ResizeObserver(items => {
|
this.resizeObserver = new window.ResizeObserver(items => {
|
||||||
if (window.parentIFrame) {
|
if (window.parentIFrame) {
|
||||||
|
|||||||
Reference in New Issue
Block a user