Ver Fonte

chore(student page): 注释掉beforeunload相关事件监听

注释页面卸载、刷新相关的beforeunload事件监听及清理逻辑,避免不必要的事件绑定问题
lsc há 3 dias atrás
pai
commit
ea6e5e4d66
1 ficheiros alterados com 3 adições e 3 exclusões
  1. 3 3
      src/views/Student/index.vue

+ 3 - 3
src/views/Student/index.vue

@@ -4004,7 +4004,7 @@ onMounted(() => {
  
   
   // beforeunload 事件(页面刷新或关闭)
-  window.addEventListener('beforeunload', handlePageUnload)
+  // window.addEventListener('beforeunload', handlePageUnload)
   
   // visibilitychange 事件(适用于 iframe 嵌套场景,当外层页面返回时触发)
   const handleVisibilityChange = () => {
@@ -4023,7 +4023,7 @@ onMounted(() => {
   
   // 存储清理函数,方便在 onUnmounted 中移除
   ;(window as any).__pptistStudentUnloadHandlers = {
-    beforeunload: handlePageUnload,
+    // beforeunload: handlePageUnload,
     visibilitychange: handleVisibilityChange,
     pagehide: handlePageUnload
   }
@@ -4073,7 +4073,7 @@ onUnmounted(() => {
   // 清理页面卸载相关的事件监听器
   if ((window as any).__pptistStudentUnloadHandlers) {
     const handlers = (window as any).__pptistStudentUnloadHandlers
-    window.removeEventListener('beforeunload', handlers.beforeunload)
+    // window.removeEventListener('beforeunload', handlers.beforeunload)
     document.removeEventListener('visibilitychange', handlers.visibilitychange)
     window.removeEventListener('pagehide', handlers.pagehide)
     delete (window as any).__pptistStudentUnloadHandlers