a1300399510@qq.com 提交于 2023/04/06 -17:20:01
This commit is contained in:
parent
b5ea5a0bf0
commit
556a6219b9
23
src/App.vue
23
src/App.vue
@ -1,20 +1,41 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<router-view />
|
{{ a }}
|
||||||
|
|
||||||
|
<!-- <router-view /> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "App",
|
name: "App",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
a: 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$store.dispatch('fetchHistoricalSearch')
|
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>
|
</script>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user