vue2中使用

    const path = require("path")
    const files = require.context("../module", true, /\index.vue$/)
    files.keys().forEach(key => {
        const name = path.dirname(key).slice(2)
        that.$options.components[name] = require('../module/' + name).default
    })

vue3使用方法

vue3继续使用上面方法会报错 具体细节未深究 解决方案:

import.meta.globEager("../../assets/authentication/*.png") 
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐