传参问题

一个页面怎么给另一个页面传个对象值呢

res={content: str, okTheme: 'alink'}

传值前需要转化 1 encodeURIComponent(JSON.stringify(res)) 

接收 1 JSON.parse(decodeURIComponent(this.$root.$mp.query.res)) 

encodeURIComponent() 函数可把字符串作为 URI 组件进行编码。

将 JavaScript 值转换为 JSON 字符串

JSON.parse() 方法用于将一个 JSON 字符串转换为对象

decodeURIComponent() 函数可对 encodeURIComponent() 函数编码的 URI 进行解码

原文地址:https://www.cnblogs.com/studyWeb/p/13440001.html