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

相关推荐
北漂的老猿1 天前
知识付费小程序 梦想贩卖机v2
小程序
我命由我123451 天前
微信小程序 - 避免在 data 初始化中引用全局变量
开发语言·前端·javascript·微信小程序·小程序·前端框架·js
白菜__1 天前
去哪儿小程序逆向分析(酒店)
前端·javascript·爬虫·网络协议·小程序·node.js
我命由我123451 天前
微信小程序 bind:tap 与 bindtap 的区别
开发语言·前端·javascript·微信小程序·小程序·前端框架·js
2501_915921431 天前
Fiddler抓包工具详解,HTTPHTTPS调试、代理配置与接口分析实战教程
服务器·ios·小程序·fiddler·uni-app·php·webview
我命由我123451 天前
微信小程序 - 页面跳转并传递参数(使用路由参数、使用全局变量、使用本地存储、使用路由参数结合本地存储)
开发语言·前端·javascript·微信小程序·小程序·前端框架·js
00后程序员张1 天前
数据流抓包实战指南,TCPUDP 流量分析、HTTPS 解密与多工具协同方案
网络协议·http·ios·小程序·https·uni-app·iphone
2501_915921431 天前
iOS 性能分析工具全景解析,构建从底层诊断到真机监控的多层级性能分析体系
android·ios·小程序·https·uni-app·iphone·webview
2501_915909061 天前
如何防止 IPA 被反编译,从攻防视角构建一套真正有效的 iOS 成品保护体系
android·macos·ios·小程序·uni-app·cocoa·iphone