uniapp页面传值总结

一、uniapp页面传值总结
1,直接传一个数字

uni.navigateTo({
						url:'../../pages/page/pay?number=1'
					})

2,传一个变量

uni.navigateTo({
						url:'../../pages/page/pay?title=' this.title
					})

3,传的值过长时

uni.navigateTo({
						url:'../../pages/page/pay?list=' + encodeURIComponent(JSON.stringify(this.getList))
					})

4,传两个及以上变量

uni.navigateTo({
							url:"../../pages/page/pay?list="+encodeURIComponent(JSON.stringify(this.getList))+ '&allprice=' +this.getAllPrice
						})

5,地址是变量时传值

uni.navigateTo({
					url: k+'?RoomNo=' + this.RoomNo
			})

pay页面接收时

onLoad(e){
     	this.number = e.number
     	this.title = JSON.parse(e.title)
		this.list = JSON.parse(decodeURIComponent(e.list))
		}
发布了17 篇原创文章 · 获赞 1 · 访问量 2734

猜你喜欢

转载自blog.csdn.net/qq_42014265/article/details/100512305
今日推荐