vue路由傳對象刷新會報錯,數據丟失,用json字符串解決

變成json字符串,且加密
 this.$router.push({name: response.body.PowerList[0].opPowerurl ,query :{ all: encodeURIComponent(JSON.stringify(response.body.all)), one: encodeURIComponent(JSON.stringify(response.body.one))}});
----------------------------------------------------------

解析json字符串,且解密
this.all = this.$route.query.all
this.one = this.$route.query.one
console.log('all', JSON.parse(decodeURIComponent(this.all)))
console.log('one', JSON.parse(decodeURIComponent(this.one)))
相關文章
相關標籤/搜索