1.在方法里面传参(cantingid是之前通过请求接口拿到的)
<div class="DIV" @click="goto(cantingid)"></div>
2.路由传参
goto(id){ //cantingid=id
this.$router.push({name:'foodinfo',query:{cid:id}}) //将餐厅id传值给下一个页面用cid接收
}
3.接收传参
this.$route.query.cid
getapp(){
this.cid=this.$route.query.cid
this.type=this.$route.query.type
this.axios.getrestaurantmenulist({
restaurantId:this.cid,
type:this.type
}).then(res=>{
this.alldata=res.data;
}).catch(res=>{
}),
//菜系名称查询
this.axios.getkindlistbytype({
params:{type:this.type}
}).then(res=>{
this.option=res.data
}).catch(res=>{
})
},