Skip to content

Commit

Permalink
docs: correct qiankun lifecycle (umijs#9981)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuitos authored Dec 7, 2022
1 parent ec75c2b commit 877d738
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions docs/docs/max/micro-frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,22 @@ export const qiankun = {

### 子应用配置生命周期钩子

在子应用的 `src/app.ts` 中导出 `qiankun` 对象,实现生命周期钩子:
在子应用的 `src/app.ts` 中导出 `qiankun` 对象,实现生命周期钩子。子应用运行时仅支持配置 bootstrap、mount、unmount 钩子

```ts
// src/app.ts
export const qiankun = {
// 子应用在挂载完成时,打印 props 信息
async afterMount(props) {
console.log(props);
// 应用加载之前
async bootstrap(props) {
console.log('app1 bootstrap', props);
},
// 应用 render 之前触发
async mount(props) {
console.log('app1 mount', props);
},
// 应用卸载之后触发
async unmount(props) {
console.log('app1 unmount', props);
},
};
```
Expand Down

0 comments on commit 877d738

Please sign in to comment.