Vue通过id跳转到商品详情页

首页列表:

在这里我用a标签进行跳转,在vue里面使用<router-link></router-link>

<router-link :to="{path:'/news',query:{ id:item.NewsID }}" class="around"></router-link>

 商品详情页:

//请求接口
created: function() { var newsID=this.$route.query.id; this.$http.get(this.$store.state.index.ip + '/api/News/'+newsID).then((response) => { console.log(response); }).catch(function(error) { console.log(error); }); }

若有不明白请加群号:复制 695182980 ,也可扫码,希望能帮助到大家。

                                      

猜你喜欢

转载自www.cnblogs.com/CinderellaStory/p/9985812.html