a1300399510@qq.com 提交于 2023/04/06 -18:00:01
This commit is contained in:
parent
0ede88dce0
commit
7c79f44ace
26
src/App.vue
26
src/App.vue
@ -1,9 +1,7 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<div class="container">
|
||||
{{ a }}
|
||||
|
||||
<!-- <router-view /> -->
|
||||
<router-view />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -14,34 +12,12 @@ export default {
|
||||
name: "App",
|
||||
data() {
|
||||
return {
|
||||
a: 1
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
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)
|
||||
})
|
||||
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>
|
||||
|
||||
|
@ -11,7 +11,7 @@ export default new Vuex.Store({
|
||||
},
|
||||
mutations: {
|
||||
setHistoricalSearch(state, payload) {
|
||||
console.log(payload, "payload");
|
||||
// console.log(payload, "payload");
|
||||
// payload = [...new Set(payload)]
|
||||
state.historicalSearch = payload
|
||||
// localStorage.setItem('historicalSearch', JSON.stringify(payload));
|
||||
@ -26,5 +26,7 @@ export default new Vuex.Store({
|
||||
|
||||
},
|
||||
modules: {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user