标签:oca before app 解决 store state assign replace tor
思路是页面关闭前将state
的数据存储到浏览器缓存里,页面加载时再取出来存到state
中
//App.vue
created () {
if (this.$getLocal("store")) {
this.$store.replaceState(
Object.assign({}, this.$store.state, this.$getLocal("store", "parse"))
);
}
window.addEventListener("beforeunload", () => {
this.$setLocal("store", this.$store.state);
});
}
标签:oca before app 解决 store state assign replace tor
原文地址:https://www.cnblogs.com/ak-b/p/10525471.html