Vue+typescript cannot use beforeRouteEnter ()

main.ts is configured as follows
import Component from "vue-class-component";
Component.registerHooks ([

)
"beforeRouteEnter",
"beforeRouteLeave",
"beforeRouteUpdate",

]);

but using beforeRouteEnter () in the component does not execute
private beforeRouteUpdate (to: Route, form: Route, next: () = > void): void {

console.log(11)
next();

}

Jan.27,2022

execute

in a new js file
//registerHooks.js
import Component from 'vue-class-component'

Component.registerHooks([
 'beforeRouteEnter',
 'beforeRouteLeave',
 'beforeRouteUpdate'     
])

then introduce registerHooks.js on top of main.ts



    import { Component } from 'vue-property-decorator';
    
    Component.registerHooks([
      'beforeRouteEnter',
    ])

what happened later? I also encountered this problem


if you just want to update the view, you can consider listening on the route

    @Watch('$route')
    routeWatch() {
        this.loadData();
    }

I use vue-cli3,@Watch. It's

.
import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
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-1b220b8-3fb6d.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-1b220b8-3fb6d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?