多组件引入
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