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麻烦点下推荐,谢谢!

posted @ 2018-12-20 19:11  黑夜蓝天  阅读(1613)  评论(0编辑  收藏  举报