feat: 页面有变更时,关闭或刷新页面弹出浏览器的保存提示
This commit is contained in:
parent
1c6c8fcb7a
commit
17090ffa3a
|
@ -34,4 +34,11 @@ export default function useLeaveTabUnSaveCheck(tabs: TabItem[], permissions?: st
|
|||
next();
|
||||
}
|
||||
});
|
||||
|
||||
// 页面有变更时,关闭或刷新页面弹出浏览器的保存提示
|
||||
window.onbeforeunload = () => {
|
||||
if (!isLeaving && tabs.some((tab) => tab.unSaved) && hasAnyPermission(permissions || [])) {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -58,6 +58,13 @@ export default function useLeaveUnSaveTip(leaveProp = leaveProps) {
|
|||
next();
|
||||
}
|
||||
});
|
||||
|
||||
// 页面有变更时,关闭或刷新页面弹出浏览器的保存提示
|
||||
window.onbeforeunload = () => {
|
||||
if (!isSave.value) {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
return {
|
||||
setIsSave,
|
||||
openUnsavedTip,
|
||||
|
|
Loading…
Reference in New Issue