一、特殊字符传参
1.如果传递的参数出现特殊字符,特殊字符会导致参数接收错误
2.解决办法
使用encodeURIComponent对传递的参数进行编码,在接收页(目标页)使用decodeURIComponent解码
二、传递对象
1.首先转json字符串
var item = {name:'张三',age:'18'}
var obj_str = encodeURIComponent(JSON.stringify(item))
uni.navigateTo({
url:`/pages/manage/cricle?item=${encodeURIComponent(JSON.stringify(item))}`
})
2.在目标页 转换为对象
var obj = JSON.parse(decodeURIComponent(obj_str));