add basic support for multiple imports
This commit is contained in:
@@ -5,3 +5,7 @@ slug: 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() {
|
||||
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
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())
|
||||
|
||||
|
||||
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 ')
|
||||
|
||||
Reference in New Issue
Block a user