Skip to content

Commit

Permalink
feat: 支持 umi3 主应用 (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuitos authored Jan 20, 2022
1 parent ca1ee71 commit 0629dec
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/slave/lifecycles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ export function genMount() {
}

export function genUnmount(mountElementId: string) {
return async (...args: any[]) => {
const container = document.getElementById(mountElementId);
return async (props: any) => {
const container = props?.container
? props.container.querySelector(`#${mountElementId}`)
: document.getElementById(mountElementId);
if (container) {
ReactDOM.unmountComponentAtNode(container);
}
const slaveRuntime = getSlaveRuntime();
if (slaveRuntime.unmount) await slaveRuntime.unmount(...args);
if (slaveRuntime.unmount) await slaveRuntime.unmount(props);
};
}

0 comments on commit 0629dec

Please sign in to comment.