微信小程序页面传值为对象[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、打印结果

相关推荐
double_eggm14 小时前
微信小程序8
微信小程序·小程序
MageGojo14 小时前
小程序每日一谜怎么做:riddle 接口接入示例
windows·小程序·apache·谜语
kyh10033811201 天前
Cocos Creator 《打螺丝消除游戏》源码+实现
游戏·微信小程序·小程序·打螺丝小游戏源码·微笑小游戏源码
烂不烂问厨房1 天前
支付宝小程序camera录制视频并上传注意事项
小程序·音视频
PeanutSplsh1 天前
wx.setStorage 存的数据,没你以为的那么安全
微信小程序
我是伪码农1 天前
小程序125-150
小程序
帅次1 天前
讯飞与腾讯云:Android 实时语音识别服务对比选择
android·ios·微信小程序·小程序·android studio·android runtime
Chengbei111 天前
小程序 AI 渗透新工具MCP!打通调试与安全检测、网络抓包、接口分析、越权检测一站式实现
人工智能·安全·web安全·搜索引擎·网络安全·小程序·系统安全
2501_915909062 天前
深入理解HTTPS中间人抓包技术原理与实战指南
网络协议·http·ios·小程序·https·uni-app·iphone
he___H2 天前
微信小程序实现两行交错功能
微信小程序·小程序