Skip to content

Commit

Permalink
fix: keepalive占满容器
Browse files Browse the repository at this point in the history
fix: keepalive占满容器
  • Loading branch information
xiaohuoni authored Aug 9, 2021
2 parents f02dbf3 + f601da9 commit 61115da
Showing 1 changed file with 20 additions and 30 deletions.
50 changes: 20 additions & 30 deletions packages/keep-alive/src/utils/getKeepAliveLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,36 +84,26 @@ export default class BasicLayout extends React.PureComponent<PageProps> {
}
return (
<>
<div
hidden={!showKeepAlive}
className="rumtime-keep-alive-layout"
>
{this.alivePathnames.map(curPathname => {
const currentView = getView(curPathname, this.keepAliveViewMap);
const { component: View, recreateTimes } = currentView;
const matchRoute = matchRoutes([currentView], curPathname)[0];
const pageProps: any = { ...this.props,...matchRoute };
return View ? (
<div
id={\`BasicLayout-\${curPathname}\`}
key={
curPathname + recreateTimes
}
style={{
position: 'absolute',
left: 0,
top: 0,
right: 0,
bottom: 0,
}}
hidden={curPathname !== pathname.toLowerCase()}
>
<View {...pageProps} />
</div>
) : null;
})}
</div>
<div hidden={showKeepAlive} className="rumtime-keep-alive-layout-no">
{this.alivePathnames.map(curPathname => {
const currentView = getView(curPathname, this.keepAliveViewMap);
const { component: View, recreateTimes } = currentView;
const matchRoute = matchRoutes([currentView], curPathname)[0];
const pageProps: any = { ...this.props,...matchRoute };
return View ? (
<div
id={\`BasicLayout-\${curPathname}\`}
key={
curPathname + recreateTimes
}
style={{ height: '100%', width: '100%', position: 'relative', overflow: 'hidden auto' }}
className="rumtime-keep-alive-layout"
hidden={curPathname !== pathname.toLowerCase()}
>
<View {...pageProps} />
</div>
) : null;
})}
<div hidden={showKeepAlive} style={{ height: '100%', width: '100%', position: 'relative', overflow: 'hidden auto' }} className="rumtime-keep-alive-layout-no">
{!showKeepAlive && this.props.children}
</div>
</>
Expand Down

0 comments on commit 61115da

Please sign in to comment.