harrywan 9181bf50ac feat: qiankun支持多页签keepalive (#117)
* fix: 判断页面权限的path统一从match中拿路由path

* fix: qiankun主应用不改rootContainer

* fix: 消除initialState为空时的warn

* refactor: modifyCreateHistroy更改为modifyCreateHistory

* fix: qiankun支持多页签keepalive
2022-04-20 10:35:16 +08:00

34 lines
872 B
Smarty
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { createMemoryHistory, getHistory } from '@@/core/coreExports';
import qiankunRender, { clientRenderOptsStack, history } from './lifecycles';
export const render = oldRender => qiankunRender().then(oldRender);
export function modifyClientRenderOpts(memo) {
// render modifyClientRenderOpts render
const clientRenderOpts = clientRenderOptsStack.shift();
return {
...memo,
...clientRenderOpts
};
}
export function modifyCreateHistory(memo) {
if (history.url) {
return createMemoryHistory
}
return memo;
}
export function onRouterCreated({ router }) {
if(history.url) {
const memoryHistory = getHistory();
memoryHistory.push(history.url)
}
if(history.onRouterInit){
history.onRouterInit(router)
}
}