|
|
@@ -61,7 +61,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { ref, defineProps, defineEmits , watch,onMounted, reactive } from 'vue'
|
|
|
+import { ref, defineProps, defineEmits , watch,onMounted, reactive,onBeforeUnmount } from 'vue'
|
|
|
import EditDialog from "./EditDialog.vue";
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus';import client from "@/stores/modules/client";
|
|
|
import icpList from '@/utils/ipc';
|
|
|
@@ -81,11 +81,27 @@ const tabs = ref([]); // 所有标签页
|
|
|
const editId = ref(0); // 当前编辑行的索引
|
|
|
const selectID = ref(0) //当前默认的ID
|
|
|
|
|
|
+
|
|
|
+onBeforeUnmount(()=>{
|
|
|
+ window.removeEventListener('beforeunload', handleBeforeUnload);
|
|
|
+})
|
|
|
+
|
|
|
onMounted(()=>{
|
|
|
+ window.addEventListener('beforeunload', handleBeforeUnload);
|
|
|
topsTab.value = 'left';
|
|
|
getTopList()
|
|
|
})
|
|
|
|
|
|
+const handleBeforeUnload = (e)=>{
|
|
|
+ if(dialogVisible.value){
|
|
|
+ e.preventDefault();
|
|
|
+ const message = '您已打开实时预览弹出框,请先取消或者保存后,关闭编辑弹出框,后再关闭此窗口';
|
|
|
+ e.returnValue = message; // 标准方式
|
|
|
+ ElMessage.error('您已打开实时预览弹出框,请先取消或者保存后,关闭编辑弹出框,后再关闭此窗口,')
|
|
|
+ return message; // 兼容某些浏览器
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
/**
|
|
|
* 监听topsTab变化,获取对应标签页的设备配置列表。
|
|
|
*/
|