fix: work around icon import for demo playground
This commit is contained in:
parent
cafc41321d
commit
8099c9efcf
@ -36,7 +36,9 @@
|
||||
ui="icon"
|
||||
@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>
|
||||
</section>
|
||||
<section
|
||||
@ -96,11 +98,16 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
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({
|
||||
'one-demo-code': {
|
||||
width: 24,
|
||||
|
@ -28,8 +28,8 @@ export function createCodeSandbox (sfc) {
|
||||
|
||||
const meta = `{
|
||||
"dependencies": {
|
||||
"veui": "2.1.1",
|
||||
"veui-theme-dls": "2.1.1",
|
||||
"veui": "2.1.2",
|
||||
"veui-theme-dls": "2.1.2",
|
||||
"vue": "2.6.14"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user