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

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: '/...'});

这里写图片描述

希望本文对您有所帮助!
个人微信公众号:小禾子的魔法盒子,欢迎关注!
这里写图片描述

猜你喜欢

转载自blog.csdn.net/JaneLittle/article/details/72179413