当前位置:网站首页>uni-app---uni. Navigateto jump parameter use

uni-app---uni. Navigateto jump parameter use

2022-07-05 09:29:00 Left hand holding * * right hand

uni-app Have their own grammar . When we use it, we pass parameters , Pass string or object ,
String pass parameters : You can splice addresses

			goreportdetails(id) {
				uni.navigateTo({
					url: '/pages/reportdetails/reportdetails?id=' + id + '&name=edit'
				})
			},

The object passes parameters : Sometimes parameters are lost , So with encodeURIComponent

uni.navigateTo({
						url: '/pages/build/build?list=' + encodeURIComponent(JSON.stringify(this.itemList)) + '&name=' + this.name +'&totalScore=' + this.totalScore + '&content=' + this.content+ '&uid=' + this.uid,
					})

Then the receiving parameters are :

onLoad(option) {
  if (option) {
    this.name = option.name
    this.uid = option.uid
    if (option.list) {
      this.list = JSON.parse(decodeURIComponent(option.list));
    }
  }
}
原网站

版权声明
本文为[Left hand holding * * right hand]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050926398866.html