多组件引入

const path = require("path");
const files = require.context("./template", false, /\.vue$/);
const modules = {};
files.keys().forEach((key) => {
  const name = path.basename(key, ".vue");
  modules[name] = files(key).default || files(key);
});
  components: {
    ...modules,

components:modules

 

posted @ 2022-04-21 13:49  ThisCall  阅读(18)  评论(0编辑  收藏  举报