Reviewed-on: http://git.mrkbear.com/MrKBear/mini-dlpu-v3/pulls/46
This commit is contained in:
commit
acf4f94798
@ -491,6 +491,27 @@ class Manager<WXC extends AnyWXContext = AnyWXContext> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异步页面加载
|
||||||
|
*
|
||||||
|
* *注意*
|
||||||
|
* 页面模块加载后,必须手动执行 loadAllModule
|
||||||
|
* loadAllModule Modular 才会真正的被加载
|
||||||
|
* 模块加载后可以处理逻辑绑定
|
||||||
|
*/
|
||||||
|
public static async PageAsync(): Promise<{
|
||||||
|
manager: Manager<AnyWXContext>,
|
||||||
|
query: Record<string, string | undefined>
|
||||||
|
}> {
|
||||||
|
return new Promise((solve) => {
|
||||||
|
Page({
|
||||||
|
async onLoad(query) {
|
||||||
|
let manager = new Manager(this);
|
||||||
|
await solve({ manager, query });
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { Manager, Modular, AnyWXContext, WXContext, ILifetime}
|
export { Manager, Modular, AnyWXContext, WXContext, ILifetime}
|
@ -4,9 +4,23 @@ import { MainFunction } from "./MainFunction";
|
|||||||
import { FunctionList } from "./FunctionList";
|
import { FunctionList } from "./FunctionList";
|
||||||
import { Mask } from "../../modular/Mask/Mask";
|
import { Mask } from "../../modular/Mask/Mask";
|
||||||
|
|
||||||
Manager.Page((manager) => {
|
(async () => {
|
||||||
|
|
||||||
|
// 初始化页面
|
||||||
|
const { manager, query } = await Manager.PageAsync();
|
||||||
|
|
||||||
|
// 添加蒙版 Modular
|
||||||
const mask = manager.addModule(Mask, "mask");
|
const mask = manager.addModule(Mask, "mask");
|
||||||
|
|
||||||
|
// 添加 UserCard Modular
|
||||||
manager.addModule(UserCard, "userCard", { mask });
|
manager.addModule(UserCard, "userCard", { mask });
|
||||||
|
|
||||||
|
// 添加 MainFunction Modular
|
||||||
manager.addModule(MainFunction, "mainFunction");
|
manager.addModule(MainFunction, "mainFunction");
|
||||||
|
|
||||||
|
// 添加 FunctionList Modular
|
||||||
manager.addModule(FunctionList, "functionList");
|
manager.addModule(FunctionList, "functionList");
|
||||||
});
|
|
||||||
|
// 初始化全部 Modular
|
||||||
|
await manager.loadAllModule(query);
|
||||||
|
})();
|
@ -28,12 +28,12 @@ implements Partial<ILifetime> {
|
|||||||
s.set("be", 12);
|
s.set("be", 12);
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|
||||||
new Login().param({studentId: "1806240113", password: "qazxsw123"})
|
// new Login().param({studentId: "1806240113", password: ""})
|
||||||
.request().wait({
|
// .request().wait({
|
||||||
ok: (w) => {console.log("ok", w)},
|
// ok: (w) => {console.log("ok", w)},
|
||||||
no: (w) => {console.log("no", w)},
|
// no: (w) => {console.log("no", w)},
|
||||||
done: (w) => {console.log("done", w)}
|
// done: (w) => {console.log("done", w)}
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,17 @@ import { TestCore } from "./TestCore";
|
|||||||
* 此页面使用 Manager 进行模块化管理
|
* 此页面使用 Manager 进行模块化管理
|
||||||
* 若要添加先功能请先定义 Modular 并添加至 Manager
|
* 若要添加先功能请先定义 Modular 并添加至 Manager
|
||||||
*/
|
*/
|
||||||
Manager.Page((manager)=>{
|
(async () => {
|
||||||
|
|
||||||
|
// 初始化页面
|
||||||
|
const { manager, query } = await Manager.PageAsync();
|
||||||
|
|
||||||
|
// 添加 StatusBar Modular
|
||||||
manager.addModule(StatusBar, "statusBar");
|
manager.addModule(StatusBar, "statusBar");
|
||||||
|
|
||||||
|
// 添加 TestCore Modular
|
||||||
manager.addModule(TestCore, "testCore");
|
manager.addModule(TestCore, "testCore");
|
||||||
})
|
|
||||||
|
// 初始化全部 Modular
|
||||||
|
await manager.loadAllModule(query);
|
||||||
|
})()
|
Loading…
Reference in New Issue
Block a user