hookehuyr

fix

......@@ -1082,17 +1082,6 @@ export default {
} 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 () {
// 设置标志位为 false,避免在刷新页面时再次显示提示框
......@@ -1839,6 +1828,19 @@ export default {
state.detailModel = null;
editor.closeModel();
}
// 监听 beforeunload 事件
window.addEventListener('beforeunload', function (event) {
const confirmationMessage = "确定要离开此页面吗?您所做的更改可能不会被保存。";
if (localStorage.getItem('showConfirmation') === '1') {
// 取消事件的默认行为(弹出确认对话框)
event.preventDefault();
event.returnValue = confirmationMessage; 
return confirmationMessage;
}
});
}
/**
......@@ -2302,6 +2304,18 @@ export default {
}
const onDragCanvas = (evt) => {
// 监听 beforeunload 事件
window.addEventListener('beforeunload', function (event) {
const confirmationMessage = "确定要离开此页面吗?您所做的更改可能不会被保存。";
if (localStorage.getItem('showConfirmation') === '1') {
// 取消事件的默认行为(弹出确认对话框)
event.preventDefault();
event.returnValue = confirmationMessage; 
return confirmationMessage;
}
});
}
/**
......