uni-app——使用uni.navigateTo传递对象参数

文章目录

  • 一、传递一般参数
  • 二、传递对象参数
    • 1.传递参数
    • 2.接收参数


一、传递一般参数

const index = 1;
uni.navigateTo({
	url: `../address/address?key=${index}`
	})

二、传递对象参数

1.传递参数

// 跳转到订单详情页面
			toOrder(item) {
				// console.log(item.hpv_id, 'hpv_id')
				uni.navigateTo({
					url: '../hpvOrder-detail/hpvOrder-detail?key=' + encodeURIComponent(JSON.stringify(item))
				})
			}

2.接收参数

navigateTo进行页面传递参数,在下一个页面接收数据,一般在在onLoad钩子函数中获取

onLoad(e) {
			this.detail = JSON.parse(decodeURIComponent(e.key));
			console.log(this.detail)
}

猜你喜欢

转载自blog.csdn.net/Bonsoir777/article/details/128454729