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))
		}

你可能感兴趣的:(uniapp,总结)