The guard beforeRouteEnter in the vue-router component triggers, but the beforeRouteLeave does not trigger.

I am in the .vue file:

export default {
  name: "SomeName",
  beforeRouteLeave(to, from, next) {
    console.log(" beforeRouteLeave !", this)
  },
  beforeRouteEnter(to, from, next) {
    console.log(" beforeRouteEnter !")
  }
}

but the guard beforeRouteEnter triggers while beforeRouteLeave does not trigger when entering the route. I wonder if my posture is not correct.

Environment: vue: 2.5.16 , Chrome65

Mar.02,2021

after my experiment, I found that it was my fault.

in the route guard, you need to call next () to enter the route. Otherwise, if there is no next () in beforeRouteEnter , the content of the guard will be executed, but the route cannot be entered. The correct way to write it is

.
  

because you do not leave (next ()); after entering
, of course there is no chance to execute beforeRouteLeave again

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