site: fix demo with script not working in codesandbox

This commit is contained in:
07akioni 2021-06-05 06:05:49 +08:00
parent 48e47f4649
commit c0ba6ec088

View File

@ -16,6 +16,29 @@ const indexHtml = `<!DOCTYPE html>
</html>
`
const appVue = `<template>
<n-loading-bar-provider>
<n-message-provider>
<n-notification-provider>
<n-dialog-provider>
<demo />
</n-dialog-provider>
</n-notification-provider>
</n-message-provider>
</n-loading-bar-provider>
</template>
<script>
import { defineComponent } from "vue";
import Demo from "./Demo.vue";
export default defineComponent({
components: {
Demo,
},
});
</script>`
const mainJs = `import { createApp } from "vue";
import naive from "naive-ui";
import App from "./App.vue";
@ -35,15 +58,21 @@ export function getCodeSandboxParams (code) {
dependencies: {
vue: 'next',
'naive-ui': 'latest'
},
devDependencies: {
'@vue/cli-plugin-babel': '~4.5.0'
}
}
},
'index.html': {
content: indexHtml
},
'src/App.vue': {
'src/Demo.vue': {
content: code
},
'src/App.vue': {
content: appVue
},
'src/main.js': {
content: mainJs
}