hookehuyr

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

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