Merge pull request #77 from ice-lab/fix-plugin-icestark

fix: get appLeave from layout
This commit is contained in:
chenbin92 2020-03-03 16:18:41 +08:00 committed by GitHub
commit 139040d94a
1 changed files with 13 additions and 17 deletions

View File

@ -75,11 +75,10 @@ const module = ({ appConfig, addDOMRender, setRenderRouter, modifyRoutes }) => {
modifyRoutes(removeRootLayout);
}
const frameworkRouter = (routes) => () => {
const [appInfo, setAppInfo] = useState({
pathname: '',
appEnter: {},
appLeave: {}
});
const [appPathname, setAppPathname] = useState('');
const [appEnter, setAppEnter] = useState({});
const [appLeave, setAppLeave] = useState({});
const [apps, setApps] = useState(null);
const routerProps = {
type,
@ -98,25 +97,22 @@ const module = ({ appConfig, addDOMRender, setRenderRouter, modifyRoutes }) => {
}, []);
function handleRouteChange(pathname) {
setAppInfo({
...appInfo,
pathname,
});
setAppPathname(pathname);
}
function handleAppLeave(config) {
setAppInfo({
...appInfo,
appLeave: config,
});
setAppLeave(config);
}
function handleAppEnter(config) {
setAppInfo({
...appInfo,
appEnter: config,
});
setAppEnter(config);
}
const appInfo = {
pathname: appPathname,
appEnter,
appLeave,
};
return (
<BasicLayout {...appInfo}>