1.router-link 跳轉的方法
<router-link :to='{path:"/CommentList",query:{id:this.$route.query.goodsid}}'>
<div class="right">
<span>查看全部</span>
<img src="../assets/image/flowerdetail_rightarrow.png" alt="">
</div>
</router-link>
2.點擊方法跳轉
this.$router.push({name: '/order/page1',params:{ id:'1'}});
this.$router.push({path: ''/order/index''});
this.$router.push({path: '/order/page1',query:{ id:'2'}});
this.$router.push({ name: 'flowerpaysuccess', params: { orderId: '321'} })
接收頁面
created(){
this.id=this.$route.params.orderId;
console.log(this.id)
}
3.有時候跳轉時需要傳遞一個數組,數組中帶有多個參數,簡便方法如下
如下的work數組中傳遞多個參數 id title img等等多個參數時
<router-link tag="aa" :to="{path:'/目標路徑',query:{arry:work}}">
export default{
data(){
return{
work:[ ],
}
}
}
在跳轉到的頁面中用 created()接收
created(){
this.work=this.$route.query.arry;
}
