问题:a页面使用push
进入到b页面,再使用push
进入到c页面,c页面使用replace
回到b页面,b页面需要点击两次才会返回a页面。
分析:页面跳转记录:a->b->c->b
现在c->b使用replace
进行跳转,所以页面的堆栈记录是a->b->b,所以b页面需要两次才会跳转到a页面。
解决:在c replace
到b的后面加上this.$router.go(-1)
回退一页。
this.$router.replace({ name: 'b' })
this.$router.go(-1)