微信小程序api的wx.navigateTo传递参数,参数太长被截取
使用encodeURIComponent和decodeURIComponent 传递字符串,如果是对象要配合使用JSON.stringify 和JSON.parse
var userId=e.currentTarget.dataset.userid; var userAvatar=e.currentTarget.dataset.avatar; var userName=e.currentTarget.dataset.username; var passData={ userName:userName, userAvatar:userAvatar, userId:userId } wx.navigateTo({ url: "../goods_list/goods_list?passData="+ encodeURIComponent(JSON.stringify(passData)), })
var options=JSON.parse(decodeURIComponent(options.passData))