【uni-app】 带参数跳转

传参页面

<view class="comment" @click="comment(detail.goods_id)"><!-- 拿到要传过去的参数 --></view>

 

methods: {
	comment:function(id){
		uni.navigateTo({
			//多个参数用&拼接:url: '../comment/comment?id='+id+'&name='+name
		    url: '../comment/comment?id='+id
		});
	},
}

要接收参数的页面

onLoad:function(option){//opthin为object类型,会序列化上页面传递的参数
    console.log(option.id);//打印出上页面传递的参数
}

  

posted @ 2020-11-18 14:20  cdgogo  阅读(2327)  评论(0编辑  收藏  举报