fix: work around icon import for demo playground
This commit is contained in:
parent
cafc41321d
commit
8099c9efcf
@ -36,7 +36,9 @@
|
|||||||
ui="icon"
|
ui="icon"
|
||||||
@click="localExpanded = !localExpanded"
|
@click="localExpanded = !localExpanded"
|
||||||
>
|
>
|
||||||
<veui-icon :name="localExpanded ? 'one-demo-code-off' : 'one-demo-code'"/>
|
<veui-icon
|
||||||
|
:name="localExpanded ? 'one-demo-code-off' : 'one-demo-code'"
|
||||||
|
/>
|
||||||
</veui-button>
|
</veui-button>
|
||||||
</section>
|
</section>
|
||||||
<section
|
<section
|
||||||
@ -96,11 +98,16 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
play () {
|
play () {
|
||||||
createCodeSandbox(this.$refs.source.textContent.replace(/from 'veui'/g, 'from \'veui/dist/veui.esm\''))
|
createCodeSandbox(preprocess(this.$refs.source.textContent))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function preprocess (code) {
|
||||||
|
return code.replace(/from 'veui'/g, `from 'veui/dist/veui.esm'`)
|
||||||
|
.replace(/(?:import 'veui-theme-dls-icons[^']+'\n)+/g, `import 'veui-theme-dls-icons/dist/icons.esm'\n`)
|
||||||
|
}
|
||||||
|
|
||||||
Icon.register({
|
Icon.register({
|
||||||
'one-demo-code': {
|
'one-demo-code': {
|
||||||
width: 24,
|
width: 24,
|
||||||
|
@ -28,8 +28,8 @@ export function createCodeSandbox (sfc) {
|
|||||||
|
|
||||||
const meta = `{
|
const meta = `{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"veui": "2.1.1",
|
"veui": "2.1.2",
|
||||||
"veui-theme-dls": "2.1.1",
|
"veui-theme-dls": "2.1.2",
|
||||||
"vue": "2.6.14"
|
"vue": "2.6.14"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user