An endless cycle encountered in the use of beforeEach in vue;

when doing the vue project, I wrote the following code. The page is stuck and there is an endless loop. Maybe there is something wrong with the logic. The boss gives reason

.

related codes

mounted () {

console.log("aaa")
let _this = this
this.$router.beforeEach(function (to,from,next) {
  if(to.meta.auth) {
    if(window.localStorage.getItem("user")) {
      console.log("");
      next()
    } else {
      console.log("")
      console.log(_this.$router, "sfafasdfasdf")
      _this.$router.push({path:"/login"})
      next({
        path: to.path,
      })
    } 
  } else {
    console.log("");
    next({
      path: to.path
    })
  }
}) 

}

I want to log in and then jump to the page that the user wants to see before on the route where the guard is set

May.25,2021

you just log in all the time. You have to jump to log in when to.pathogenetic login account account log' and do not log in.







MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e496bb-439ed.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e496bb-439ed.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?