add basic support for multiple imports

This commit is contained in:
Philipp Kühn
2020-03-04 23:27:39 +01:00
parent 560d453356
commit 60d6a34d14
5 changed files with 37 additions and 7 deletions

View File

@@ -5,3 +5,7 @@ slug: test
test
import Preview from '../../src/components/Preview.vue'
<!-- import CurrentTime from '../../src/components/CurrentTime.vue' -->
<preview path="Time" />

View File

@@ -28,8 +28,20 @@ export default {
},
mounted() {
this.content = require(`!!raw-loader!~/components/${this.path}`).default
this.component = require(`~/components/${this.path}`).default
const files = require.context(`~/demos/`, true)
.keys()
.filter(path => path.startsWith(`./${this.path}`))
.filter(path => path.endsWith('.vue') || path.endsWith('.js') || path.endsWith('.css'))
.map(path => path.replace('./', ''))
.map(path => ({
path: path.replace(`${this.path}/`, ''),
content: require(`!!raw-loader!~/demos/${path}`).default
}))
console.log(files)
// this.content = require(`!!raw-loader!~/components/${this.path}`).default
// this.component = require(`~/components/${this.path}`).default
}
}
</script>

14
src/demos/Time/index.vue Normal file
View File

@@ -0,0 +1,14 @@
<template>
<div>
Time: {{ new Date() }}
</div>
</template>
<style scoped>
div {
background-color: black;
border-radius: 5px;
color: white;
padding: 20px;
}
</style>s

0
src/demos/Time/style.css Normal file
View File

View File

@@ -23,16 +23,16 @@ export default {
// console.log(tiptap())
new Editor({
element: this.$refs.editor,
content: '<p>test <strong>strong</strong></p>',
})
// new Editor({
// element: this.$refs.editor,
// content: '<p>test <strong>strong</strong></p>',
// })
// .setContent('<p>hey</p>')
// .registerCommand('lol', (next) => {
// console.log('lol')
// next()
// })
.focus('end')
// .focus('end')
// .insertText('mega ')
// .focus('start')
// .command('insertText', 'giga ')