vue 使用 this.$router.go(-1) 报错导航重复

离谱的事情 使用 this.$router.go(-1) 时报错导航重复 Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location:

我能很确定记录有两条

找到问题了
监听返回的时候往路由记录里面添加了一次当前路由 history.pushState(null, null, document.URL)


 beforeRouteEnter(to, from, next) {
    next(vm => {
      window.sessionStorage.setItem('lasterRouter', from.path)
    })
  },


//返回事件时调用
this.$router.push(window.sessionStorage.getItem('lasterRouter'))

或者直接调用浏览器的window.history.back()