在created、mounted 都行啊。
window.addEventListener('beforeunload', e => {
localStorage.setItem("store",JSON.stringify(this.$store.state))
});
在created、mounted 都行啊。
window.addEventListener('beforeunload', e => {
localStorage.setItem("store",JSON.stringify(this.$store.state))
});
转载于:https://www.cnblogs.com/lijjj/p/10821613.html