From 556a6219b934b108c3d5d762ce84168344140f95 Mon Sep 17 00:00:00 2001 From: XiaoMo <a1300399510@qq.com> Date: Thu, 6 Apr 2023 17:20: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:20:01?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/App.vue b/src/App.vue index a0c4134..edcef4f 100755 --- a/src/App.vue +++ b/src/App.vue @@ -1,20 +1,41 @@ <template> <div id="app"> <div class="container"> - <router-view /> + {{ a }} + + <!-- <router-view /> --> </div> + </div> </template> <script> + export default { name: "App", data() { return { + a: 1 } }, mounted() { this.$store.dispatch('fetchHistoricalSearch') + this.a = localStorage.getItem("a") || "默认" + // console.log(this.a); + window.addEventListener("pagehide", () => { + localStorage.setItem("a", Number(this.a) + 1) + }) + window.addEventListener("visibilitychange", () => { + localStorage.setItem("a", Number(this.a) + 1) + }) + window.addEventListener("popstate", () => { + localStorage.setItem("a", Number(this.a) + 1) + }) + }, + + beforeDestroy(){ + localStorage.setItem("a", Number(this.a) + 1) + } } </script>