From 5fb67b6436f1d0a5e5f2035e59845b6ef9e0d7d5 Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期二, 05 十一月 2024 10:59:13 +0800
Subject: [PATCH] 模版添加赠送字段

---
 src/App.vue |   33 +++++++++++++++++++++++++++++----
 1 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/src/App.vue b/src/App.vue
index ec9032c..6bb22ac 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,11 +1,36 @@
 <template>
-  <div id="app">
-    <router-view />
-  </div>
+    <div id="app">
+        <router-view v-if="isRouterAlive" />
+    </div>
 </template>
 
 <script>
 export default {
-  name: 'App'
+    name: 'App',
+    provide() {
+        return {
+            reload: this.reload
+        }
+    },
+    data() {
+        return {
+            isRouterAlive: true
+        }
+    },
+    mounted() {
+        // 鍏抽棴娴忚鍣ㄧ獥鍙g殑鏃跺�欐竻绌烘祻瑙堝櫒缂撳瓨鍦╨ocalStorage鐨勬暟鎹�
+        window.onbeforeunload = function (e) {
+            var storage = window.localStorage;
+            storage.clear()
+        }
+    },
+    methods: {
+        reload() {
+            this.isRouterAlive = false
+            this.$nextTick(function () {
+                this.isRouterAlive = true
+            })
+        }
+    }
 }
 </script>

--
Gitblit v1.8.0