更新
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
path : "components/*/*.js",
|
||||
app_path: "app/*/components/*/*.js",
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user