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>
|
<template>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{{ a }}
|
<router-view />
|
||||||
|
|
||||||
<!-- <router-view /> -->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -14,34 +12,12 @@ 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("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>
|
</script>
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ export default new Vuex.Store({
|
|||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
setHistoricalSearch(state, payload) {
|
setHistoricalSearch(state, payload) {
|
||||||
console.log(payload, "payload");
|
// console.log(payload, "payload");
|
||||||
// payload = [...new Set(payload)]
|
// payload = [...new Set(payload)]
|
||||||
state.historicalSearch = payload
|
state.historicalSearch = payload
|
||||||
// localStorage.setItem('historicalSearch', JSON.stringify(payload));
|
// localStorage.setItem('historicalSearch', JSON.stringify(payload));
|
||||||
@ -26,5 +26,7 @@ export default new Vuex.Store({
|
|||||||
|
|
||||||
},
|
},
|
||||||
modules: {
|
modules: {
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user