this.$router.push页面不跳转 -- 记一个糊涂的 Bug,排查了好久

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了this.$router.push页面不跳转 -- 记一个糊涂的 Bug,排查了好久相关的知识,希望对你有一定的参考价值。

参考技术A 项目中有个 Bug,最后的问题就是使用 this.$router.push 到目标页面之后,目标页面没有出现,但是其数据却加载了。展示的是当前页面,当前页面的数据重新加载。导致一系列的错误提示。

别觉得他是个多难的问题。。。

鼓捣了老长时间,发现是组件 name 重名。

vue路由跳转 返回上一级 this.$router.go(-1) 和返回到指定页面this.$router.push('/home')

1,点击返回上一页
<button @click="goback">goback</button>
methods:{
goback(){}
this.$router.go(-1)
}
2,点击跳转到/Foo2页面
<button @click="ToLink1">goback</button>
ToLink1(){
this.$router.push(‘/foo2‘) 最常用
或者this.$router.push({name:‘Foo1‘})对象的方法
 







以上是关于this.$router.push页面不跳转 -- 记一个糊涂的 Bug,排查了好久的主要内容,如果未能解决你的问题,请参考以下文章

vue路由如何返回到指定页面

vue路由跳转页面的几种方式及其区别

Vue路由this.$router.push跳转页面不刷新

VueRouter 中' this.$router.push '跳转页面不刷新的问题解决

vue路由跳转 返回上一级 this.$router.go(-1) 和返回到指定页面this.$router.push('/home')

vue路由跳转