Excuse me, use vue-router to jump to a page, and then router.beforeEach triggers twice why?

problem description

when I integrate the front and background of a project, the login page " http://localhost:8080/-sharp/Manage_Login/ "automatically jumps to" http://localhost:8080/-sharp/Index", and then I don"t use routing redirection. Later, I found that router.beforeEach triggered it twice. Why

the environmental background of the problems and what methods you have tried

related codes

router.beforeEach((to, from, next) => {
  var data = JSON.parse(localStorage.getItem("key"));
  console.log("to", to,"from", from)
  if (to.matched.some(r => r.meta.requireAuth)) {
    if (data) {    
      next();
    } else {
      var state = localStorage.getItem("state");
      //
      if (state === 0) {
        next({
          path: "/ErrorPage/!"
          // query: {redirect: to.fullPath}
        })
      } else {
       
        next({
          path: "/Login",
          query: {
            redirect: to.fullPath
          }
        })
      }
    }
  } else {
    console.log(1)
    next();
  }
  /* title */
  if (to.meta.title) {
    document.title = to.meta.title
  }
  console.log(2)
  // next()
})
< H1 > triggered router.beforeEach twice < / H1 >

clipboard.png

Jan.24,2022

there is indeed such a problem, this needs to take a look at the source code to understand, these three parameters are in order.

the code for the problem is as follows:

  

what is your problem?

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-1e3f031-4cb9b.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-1e3f031-4cb9b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?