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)))

  


原文地址:https://www.cnblogs.com/-flq/p/10453396.html