首页 > 其他 > 详细

vue中跳转的方法

时间:2019-12-16 15:13:04      阅读:269      评论:0      收藏:0      [点我收藏+]

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" >
        </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‘}});

  

  

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;
}

  

vue中跳转的方法

原文:https://www.cnblogs.com/fei3/p/12048789.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!