入口文件

This commit is contained in:
yanran200730
2022-03-02 14:07:26 +08:00
parent 2237b065c3
commit 1552fa3ba9

22
examples/entries.js Normal file
View File

@@ -0,0 +1,22 @@
//引入当前工程所有的应用
const install = function(Vue) {
if (install.installed) return Promise.resolve();
else {
let contexts = require.context('../project/shandong10086/apps', true, /(\/.+)\/App[^\/]+\.vue$/);
if (contexts) {
contexts.keys().map((e) => {
if (contexts(e).default) {
Vue.component(contexts(e).default.name, contexts(e).default);
}
});
}
}
};
// 判断是否是直接引入文件
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue);
}
export default {
// 导出的对象必须具有 install才能被 Vue.use() 方法安装
install
};