This commit is contained in:
robin
2022-07-07 22:16:39 +08:00
parent 264ab8d979
commit a9a4bd0981
86 changed files with 1198 additions and 310 deletions
+4
View File
@@ -0,0 +1,4 @@
module.exports = {
path : "components/*/*.js",
app_path: "app/*/components/*/*.js",
}
+21
View File
@@ -0,0 +1,21 @@
/**
* 通用组件
* 加载components文件夹下的函数
*/
const config = require("./config")
module.exports = async (app) => {
const list = await app.load(config.path)
Object.assign(list, await app.load(config.app_path))
app.components = {}
list.forEach(item => {
if (!app.components[item.parse.file_father]) {
app.components[item.parse.file_father] = {}
}
if (item.parse.name==='index') {
Object.assign(app.components[item.parse.file_father],item.res)
}else {
app.components[item.parse.file_father][item.parse.name] = item.res
}
})
app.alias["$components"] = app.components
}