问题:如图依次点击 首页 和 我的 tab按钮,点击返回按键时 页面会逆向一次跳转。
例如:首页>我的>首页>我的
点击返回按键时:我的>首页>我的>首页

image.png
解决方法:在路由跳转时我使用的是
this.$router.push('/'),改成this.$router.replace('/')即可。
原因:this.$router.push()它不会向 浏览器history 添加新记录,而是跟它的方法名一样会替换掉当前的 history 记录。