vue2.0中.vue文件页面跳转之.$router.push

来源:互联网 发布:定增pe天使投资知乎 编辑:程序博客网 时间:2024/06/05 04:40

vue2.0在使用的过程中, .vue文件之间的跳转,在template中的常见写法是:

<router-link to="/miniCard/statement/horizon">     <button class="btn btn-default colorDe">继续</button></router-link>

这里写图片描述

但是有时的需求是页面不直接跳转,有确认弹框或者其他事件,此时就需要在js中设置跳转,常用的一种方法是 .$router.push ,用法如下:

this.$router.push({path: '/...'});

这里写图片描述

希望本文对您有所帮助!

原创粉丝点击