From 0ede88dce08f0415371d74aa604aca4e084e7e59 Mon Sep 17 00:00:00 2001 From: XiaoMo Date: Thu, 6 Apr 2023 17:40:11 +0800 Subject: [PATCH] =?UTF-8?q?a1300399510@qq.com=20=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BA=8E=202023/04/06=20-17:40:01?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/App.vue b/src/App.vue index edcef4f..184437e 100755 --- a/src/App.vue +++ b/src/App.vue @@ -21,6 +21,11 @@ export default { this.$store.dispatch('fetchHistoricalSearch') this.a = localStorage.getItem("a") || "默认" // console.log(this.a); + + window.addEventListener("beforeunload", () => { + localStorage.setItem("a", Number(this.a) + 1) + }) + window.addEventListener("pagehide", () => { localStorage.setItem("a", Number(this.a) + 1) }) @@ -31,6 +36,7 @@ export default { localStorage.setItem("a", Number(this.a) + 1) }) + }, beforeDestroy(){