add basic support for multiple imports
This commit is contained in:
@@ -5,3 +5,7 @@ slug: test
|
|||||||
|
|
||||||
test
|
test
|
||||||
|
|
||||||
|
import Preview from '../../src/components/Preview.vue'
|
||||||
|
<!-- import CurrentTime from '../../src/components/CurrentTime.vue' -->
|
||||||
|
|
||||||
|
<preview path="Time" />
|
||||||
@@ -28,8 +28,20 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.content = require(`!!raw-loader!~/components/${this.path}`).default
|
const files = require.context(`~/demos/`, true)
|
||||||
this.component = require(`~/components/${this.path}`).default
|
.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>
|
</script>
|
||||||
|
|||||||
14
src/demos/Time/index.vue
Normal file
14
src/demos/Time/index.vue
Normal 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
0
src/demos/Time/style.css
Normal file
@@ -23,16 +23,16 @@ export default {
|
|||||||
// console.log(tiptap())
|
// console.log(tiptap())
|
||||||
|
|
||||||
|
|
||||||
new Editor({
|
// new Editor({
|
||||||
element: this.$refs.editor,
|
// element: this.$refs.editor,
|
||||||
content: '<p>test <strong>strong</strong></p>',
|
// content: '<p>test <strong>strong</strong></p>',
|
||||||
})
|
// })
|
||||||
// .setContent('<p>hey</p>')
|
// .setContent('<p>hey</p>')
|
||||||
// .registerCommand('lol', (next) => {
|
// .registerCommand('lol', (next) => {
|
||||||
// console.log('lol')
|
// console.log('lol')
|
||||||
// next()
|
// next()
|
||||||
// })
|
// })
|
||||||
.focus('end')
|
// .focus('end')
|
||||||
// .insertText('mega ')
|
// .insertText('mega ')
|
||||||
// .focus('start')
|
// .focus('start')
|
||||||
// .command('insertText', 'giga ')
|
// .command('insertText', 'giga ')
|
||||||
|
|||||||
Reference in New Issue
Block a user