vue,下级页面刷新导致路由跳转带过来的数据消失的解决方法

if(typeof(this.$route.query.result)=='string'){  
  //刷新时走这
}else{
//正常路由跳转过来后就把数据塞到 localStorage let obj
= JSON.stringify(this.$route.query); //转化为JSON字符串 localStorage.setItem("prizeResult", obj); //数据存storage,防止刷新丢失 }
去localStorage取 let result
= JSON.parse(localStorage.getItem("prizeResult")); //对自己的业务逻辑进行处理 this.showAll(result);

各位老铁, 走过路过,觉得OK麻烦点下推荐,谢谢!

原文地址:https://www.cnblogs.com/1rookie/p/10151634.html