微信小程序页面传值为对象[Object Object]详解

微信小程序页面传值为对象Object Object详解

1、先将传递的对象转化为JSON字符串拼接到url上

javascript 复制代码
 // info为对象
let stationInfo = JSON.stringify(info)
uni.navigateTo({
   url: `/pages/station-detail/station-detail?stationInfo=${stationInfo}`
 })

2、在接受对象页面进行转译

javascript 复制代码
onLoad(options) {
	let stationData = JSON.parse(options.stationInfo)
	console.log(stationData);
},

3、打印结果

相关推荐
肖有米XTKF864619 小时前
肖有米团队开发:青蓝山泉送水模式系统
小程序·团队开发·零售·csdn开发云
double_eggm1 天前
微信小程序7
微信小程序·小程序
程序鉴定师1 天前
上海小程序开发的坚实保障与行业优势解析
大数据·小程序
double_eggm1 天前
微信小程序8
微信小程序·小程序
MageGojo1 天前
小程序每日一谜怎么做:riddle 接口接入示例
windows·小程序·apache·谜语
kyh10033811202 天前
Cocos Creator 《打螺丝消除游戏》源码+实现
游戏·微信小程序·小程序·打螺丝小游戏源码·微笑小游戏源码
烂不烂问厨房2 天前
支付宝小程序camera录制视频并上传注意事项
小程序·音视频
PeanutSplsh2 天前
wx.setStorage 存的数据,没你以为的那么安全
微信小程序
我是伪码农2 天前
小程序125-150
小程序
帅次2 天前
讯飞与腾讯云:Android 实时语音识别服务对比选择
android·ios·微信小程序·小程序·android studio·android runtime