Browse Source

退出记录时间

skyblued 2 năm trước cách đây
mục cha
commit
9c97e7d20f
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      src/subpages/colexiu/App.tsx

+ 4 - 0
src/subpages/colexiu/App.tsx

@@ -76,6 +76,10 @@ export default defineComponent({
       timer = setInterval(() => {
         recordTotalTime()
       }, 60 * 1000)
+      window.addEventListener('beforeunload', () => {
+        clearInterval(timer)
+        recordTotalTime()
+      })
     })
 
     return () => <router-view></router-view>