Is the beforeRouteLeave written in the route or in the component?

Why can"t I output it when I write it in the route? Baidu did not find an example of where to write for a long time.
I think router documents do not have this usage. Did you cancel it? Link description

{
      path: "/add",
      name: "add",
      component: Add,
      beforeRouteLeave (to, from, next) {
        console.log(1)
      }
    }
Feb.25,2022

beforeRouteLeave ide/advanced/navigation-guards.html-sharp%E7%BB%84%E4%BB%B6%E5%86%85%E7%9A%84%E5%AE%88%E5%8D%AB" rel=" nofollow noreferrer "> link description


written in a vue file
clipboard.png


has not been found by Baidu for a long time. The official document is written clearly, so frivolous, write a Mao code ah?

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