This commit is contained in:
archer
2023-07-18 16:26:57 +08:00
parent 2330186a09
commit a993eba7f0
13 changed files with 45 additions and 42 deletions

View File

@@ -29,7 +29,7 @@ const AppDetail = ({ currentTab }: { currentTab: `${TabEnum}` }) => {
const router = useRouter();
const theme = useTheme();
const { appId } = router.query as { appId: string };
const { appDetail = defaultApp } = useUserStore();
const { appDetail = defaultApp, clearAppModules } = useUserStore();
const setCurrentTab = useCallback(
(tab: `${TabEnum}`) => {
@@ -53,16 +53,17 @@ const AppDetail = ({ currentTab }: { currentTab: `${TabEnum}` }) => {
[]
);
// useEffect(() => {
// window.onbeforeunload = (e) => {
// e.preventDefault();
// e.returnValue = '内容已修改,确认离开页面吗?';
// };
useEffect(() => {
window.onbeforeunload = (e) => {
e.preventDefault();
e.returnValue = '内容已修改,确认离开页面吗?';
};
// return () => {
// window.onbeforeunload = null;
// };
// }, []);
return () => {
window.onbeforeunload = null;
clearAppModules();
};
}, []);
return (
<PageContainer>