Vue global routing beforeEach execution judgment is an error

prompts you to report an error when verifying whether it is a Wechat browser:

clipboard.png

:

clipboard.png

Global routing judgment Code:

router.beforeEach((to,from,next)=>{

  // title
  const title = to.meta && to.meta.title;
  if (title) {
    document.title = title;
  }
  // 
  if((_need && isWeiXin()) ||!_need){
    next();
  }else{
    next({ path: "/error", replace: true, query: { noGoBack: true }})
  }
})

do you know what the reason is and how to solve it?


is the routing of / error running in an endless loop, and it is not judged to release it directly by next when / error is removed


positive solution upstairs, and then went to adjust

router.beforeEach((to,from,next)=>{

  // title
  const title = to.meta && to.meta.title;
  if (title) {
    document.title = title;
  }
  //next()
  if((_need && isWeiXin()) ||!_need){
    next()
  }else{
    ///error  beforeEach,
    if(to.path==='/error'){ //
      next()
    }else{
      next({ path: '/error',replace:true, query: { noGoBack: true }})
    }
  }

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