1. 程式人生 > >vue,下級頁面刷新導致路由跳轉帶過來的數據消失的解決方法

vue,下級頁面刷新導致路由跳轉帶過來的數據消失的解決方法

導致 頁面 owa eof color query 刷新 轉化 pri

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,下級頁面刷新導致路由跳轉帶過來的數據消失的解決方法