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

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

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

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

onLoad(options) {
    
    
	let stationData = JSON.parse(options.stationInfo)
	console.log(stationData);
},

3、打印结果

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/DZQ1223/article/details/132046755
今日推荐