美文网首页
2021-09-27 批量引入组件

2021-09-27 批量引入组件

作者: 罗不错 | 来源:发表于2021-10-26 17:40 被阅读0次

const path = require('path')

const file = require.context('./', true, /.vue/)
const components = {}
file.keys().forEach(key => {
const name = path.basename(key, '.vue')
components[name] = file(key).default || file(key)
})

export default components

相关文章

网友评论

      本文标题:2021-09-27 批量引入组件

      本文链接:https://www.haomeiwen.com/subject/sccknltx.html