//:to="{path:'/chapter',query:{id:i.id}}"//传参
//:to="{path:'/chapter',params:{id:i.id}}//"传参
this.$route.query.id,//取参数
this.$router.push({
path: 'yourPath',
name: '要跳转的路径的 name,在 router 文件夹下的 index.js 文件内找',
params: {
name: 'name',
dataObj: this.msg
}
/*query: {
name: 'name',
dataObj: this.msg
}*/
})
//decodeuricomponent
//在页面加载时读取localStorage里的状态信息
localStorage.getItem("vuex_store") && this.$store.replaceState(Object.assign(this.$store.state,JSON.parse(localStorage.getItem("vuex_store"))));
//在页面刷新时将vuex里的信息保存到localStorage里
window.addEventListener("beforeunload",()=>{
localStorage.setItem("vuex_store",JSON.stringify(this.$store.state))
});
//this.$router.push({path:'/home'})