mirror of https://github.com/alibaba/ice.git
				
				
				
			Merge pull request #77 from ice-lab/fix-plugin-icestark
fix: get appLeave from layout
This commit is contained in:
		
						commit
						139040d94a
					
				|  | @ -75,11 +75,10 @@ const module = ({ appConfig, addDOMRender, setRenderRouter, modifyRoutes }) => { | ||||||
|       modifyRoutes(removeRootLayout); |       modifyRoutes(removeRootLayout); | ||||||
|     } |     } | ||||||
|     const frameworkRouter = (routes) => () => { |     const frameworkRouter = (routes) => () => { | ||||||
|       const [appInfo, setAppInfo] = useState({ |       const [appPathname, setAppPathname] = useState(''); | ||||||
|         pathname: '', |       const [appEnter, setAppEnter] = useState({}); | ||||||
|         appEnter: {}, |       const [appLeave, setAppLeave] = useState({}); | ||||||
|         appLeave: {} | 
 | ||||||
|       }); |  | ||||||
|       const [apps, setApps] = useState(null); |       const [apps, setApps] = useState(null); | ||||||
|       const routerProps = { |       const routerProps = { | ||||||
|         type, |         type, | ||||||
|  | @ -98,26 +97,23 @@ const module = ({ appConfig, addDOMRender, setRenderRouter, modifyRoutes }) => { | ||||||
|       }, []); |       }, []); | ||||||
| 
 | 
 | ||||||
|       function handleRouteChange(pathname) { |       function handleRouteChange(pathname) { | ||||||
|         setAppInfo({ |         setAppPathname(pathname); | ||||||
|           ...appInfo, |  | ||||||
|           pathname, |  | ||||||
|         }); |  | ||||||
|       } |       } | ||||||
|      |      | ||||||
|       function handleAppLeave(config) { |       function handleAppLeave(config) { | ||||||
|         setAppInfo({ |         setAppLeave(config); | ||||||
|           ...appInfo, |  | ||||||
|           appLeave: config, |  | ||||||
|         }); |  | ||||||
|       } |       } | ||||||
|      |      | ||||||
|       function handleAppEnter(config) { |       function handleAppEnter(config) { | ||||||
|         setAppInfo({ |         setAppEnter(config); | ||||||
|           ...appInfo, |  | ||||||
|           appEnter: config, |  | ||||||
|         }); |  | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  |       const appInfo = { | ||||||
|  |         pathname: appPathname, | ||||||
|  |         appEnter, | ||||||
|  |         appLeave, | ||||||
|  |       }; | ||||||
|  |    | ||||||
|       return ( |       return ( | ||||||
|         <BasicLayout {...appInfo}> |         <BasicLayout {...appInfo}> | ||||||
|           {apps && ( |           {apps && ( | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue