在商品页面除了id给详情页面,但是详情页面拿不到id是怎么原因,求大神帮忙看一下哪里写错了?
商品页面代码:
<ul class="recommend_left_main">
<li v-for="(item2,index) in recommendshop" :key="index"
@click="pushdetails()">
<div class="recommend_left_main_img">
<img :src="item2.img" width="130px" height="120px" />
</div>
<div
class="recommend_left_main_describe"
:title="item2.describe"
>
{{ item2.describe | aa }}
</div>
<p class="recommend_left_main_num">¥{{ item2.price }}</p>
</li>
</ul>
//跳转详情
pushdetails(id){
this.$router.push({
name:'ProductDetails',
query:{
id:this.id
}
})
},
在详情页面进行接收的代码:
created(){
this.id=this.$route.query.id;
console.log(this.id)
this.getGoodsInfo();
},
methods:{
getGoodsInfo(){
let that=this;
this.axios
.studentFindProdutDetails({
id:that.id
})
.then((res) =>{
console.log(res.data.data)
})
.catch((err) =>{})
}
}