refactoring
This commit is contained in:
@@ -49,11 +49,7 @@ export default {
|
|||||||
content: null,
|
content: null,
|
||||||
currentIndex: 0,
|
currentIndex: 0,
|
||||||
syntax: {
|
syntax: {
|
||||||
js: 'javascript',
|
|
||||||
jsx: 'jsx',
|
|
||||||
vue: 'markup',
|
vue: 'markup',
|
||||||
css: 'css',
|
|
||||||
scss: 'scss',
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -84,13 +80,17 @@ export default {
|
|||||||
.keys()
|
.keys()
|
||||||
.filter(path => path.startsWith(`./${this.name}`))
|
.filter(path => path.startsWith(`./${this.name}`))
|
||||||
.map(path => path.replace('./', ''))
|
.map(path => path.replace('./', ''))
|
||||||
.map(path => ({
|
.map(path => {
|
||||||
path,
|
const extension = path.split('.').pop()
|
||||||
name: path.replace(`${this.name}/`, ''),
|
|
||||||
content: require(`!!raw-loader!~/demos/${path}`).default,
|
return {
|
||||||
extension: path.split('.').pop(),
|
path,
|
||||||
highlight: this.syntax[path.split('.').pop()] || 'markup',
|
name: path.replace(`${this.name}/`, ''),
|
||||||
}))
|
content: require(`!!raw-loader!~/demos/${path}`).default,
|
||||||
|
extension,
|
||||||
|
highlight: this.syntax[extension] || extension,
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user