d28764c3 by 杨威

处理store数据在页面刷新后丢失问题

1 parent c579ca83
<template>
<div id="app">
<router-view/>
</div>
<div id="app">
<router-view />
</div>
</template>
<script>
export default {
mounted() {
window.addEventListener("unload", this.saveState);
},
methods: {
saveState() {
sessionStorage.setItem("state", JSON.stringify(this.$store.state));
},
},
};
</script>
......
......@@ -8,7 +8,7 @@ import setTabs from './modules/setTabs'
Vue.use(Vuex)
const store = new Vuex.Store({
state: {
state: sessionStorage.getItem('state') ? JSON.parse(sessionStorage.getItem('state')): {
zdbsm:'',
xzqList:[],
djqList:[],
......