feat: createApp时拿取onReady的入参

This commit is contained in:
wuyue.xht 2020-11-03 00:10:21 +08:00
parent c8148e4bc4
commit 92d29c6b1b
2 changed files with 4 additions and 3 deletions

View File

@ -250,7 +250,8 @@ export default class Provider {
}
// 定制构造根组件的逻辑,如切换路由机制
createApp() {
// eslint-disable-next-line
createApp(params?: any) {
throw new Error('Method called "createApp" not implemented.');
}

View File

@ -28,13 +28,13 @@ export default function runApp() {
if (!provider) {
throw new Error('Please register class Provider');
}
provider.onReady(() => {
provider.onReady((params) => {
const promise = provider.async();
promise.then((config: IAppConfig) => {
if (!config) {
return;
}
const App = provider.createApp();
const App = provider.createApp(params);
provider.runApp(App, config);
}).catch((err: Error) => {
console.error(err.message);