hookehuyr

fix 处理iframe模式下 其他窗口可能提示刷新的问题

......@@ -1075,13 +1075,23 @@ export default {
// 显示提示框的标志位
onMounted(async () => {
document.title = '可视化流程设计器'
localStorage.setItem('showConfirmation', '1'); // 打开刷新提示框
// TAG:打开刷新提示框
if (urlQuery.type !== 'preview') {
localStorage.setItem('showConfirmation', '1');
} else { // 预览模式下不显示刷新提示框
localStorage.setItem('showConfirmation', '0');
}
// 监听 beforeunload 事件
window.addEventListener('beforeunload', function (event) {
const confirmationMessage = "确定要离开此页面吗?您所做的更改可能不会被保存。";
if (localStorage.getItem('showConfirmation') === '1') {
// 取消事件的默认行为(弹出确认对话框)
event.preventDefault();
event.returnValue = confirmationMessage; 
return confirmationMessage;
}
});
// 监听 unload 事件
window.addEventListener('unload', function () {
......