Vue Lifecycle?

there are three routing components in a page: the created method is called only when the routing component jumps in for the first time. Is there a method that will be called automatically every time you jump to this routing page?

Mar.03,2021

  1. mounted; in the lifecycle
  2. Guards within components
beforeRouteEnter
beforeRouteUpdate (2.2 )
beforeRouteLeave

clipboard.png


write mounted in a subcomponent or use the vue-router hook function


is it possible that this requirement needs to listen for routing changes to handle the corresponding changes?

watch: {
  $route() {
    // do somethings ...
  }
}

every time you jump to this routing page, isn't watch listening on the route?

watch: {
    $route(to,from){
    // to => route
    // from => route
    this._getData(); // todo
}
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-1e9f544-1a4b.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-1e9f544-1a4b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?