初始化
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
|
||||
const files = require.context('./plugin', true, /index\.js$/); //批量读取模块文件
|
||||
const pluginMain = {}
|
||||
const plugin = files.keys().reduce((modules, path) => {
|
||||
const name = path.replace(/^\.\/(.*)\.js$/, '$1');
|
||||
const module = files(path);
|
||||
// console.log(module);
|
||||
modules[name] = module.default && module.default(Vue) || null;
|
||||
if (modules[name]) {
|
||||
pluginMain[modules[name].name] = modules[name].value
|
||||
}
|
||||
return modules;
|
||||
}, {});
|
||||
Vue.config.productionTip = false
|
||||
// console.log('pluginMain',pluginMain);
|
||||
new Vue({
|
||||
render: h => h(App),
|
||||
// components: { App },
|
||||
...pluginMain,
|
||||
}).$mount('#app')
|
||||
Reference in New Issue
Block a user