Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在umi4中 使用 使用wrappers布局 缓存组件使用outlet 无法正常缓存,通过 getCachingNodes 只能获取一个节点 #302

Open
killer-wu opened this issue Dec 12, 2023 · 0 comments

Comments

@killer-wu
Copy link

killer-wu commented Dec 12, 2023

import { KeepAliveContainer } from '@/components/KeepAliveWrapper';
import { Outlet, useLocation } from '@umijs/max';
import { FC } from 'react';

const KeepAliveWrapper: FC = () => {
const location = useLocation();

return (
<>
<KeepAliveContainer name={location.pathname}>
<Outlet />
</KeepAliveContainer>
</>
);
};

export default KeepAliveWrapper;

export const KeepAliveContainer = (props: any) => {
return (
<>
<KeepAlive name={props.name}>{props.children}</KeepAlive>
</>
);
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant