vorschau
v0.1.0
Published
✨A universal demo code previewer
Downloads
1
Readme
vorschau
✨A universal demo code previewer
Usage
<script>
<script src="https://cdn.jsdelivr.net/npm/@babel/[email protected]/babel.min.js" type="application/javascript"></script>
<script src="https://cdn.jsdelivr.net/npm/@umd-pkg/[email protected]/dist/index.min.js"></script>
<script>
Vorschau.createPreviewer({
el: '#foo',
lang: 'vue3',
externals: {
vue: {
global: 'Vue',
script: 'https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/3.2.6/vue.global.js',
highPriority: true,
},
'element-plus': {
global: 'ElementPlus',
script: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/index.full.js',
style: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/index.css',
},
},
plugins: ['ElementPlus'],
code: `
import { defineComponent, ref } from 'vue'
export default defineComponent({
setup() {
const count = ref(0);
function add() {
count.value += 1;
}
window.foo = 'foo';
return { count, add };
},
render() {
return <el-button onClick={this.add}>{this.count}</el-button>
}
})`,
})
</script>
</script>