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

Posted 1rookie

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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);

 



以上是关于vue,下级页面刷新导致路由跳转带过来的数据消失的解决方法的主要内容,如果未能解决你的问题,请参考以下文章