When is the function execution time called in the vue template?

<div id="app">
  <p id="age">me:{{me()}}

</div>
new Vue({
    el:"-sharpapp",
    data:{
      y:454,
   },
   methods:{
       me(a){
          console.log("methods is run",this.y)
          return this.y;
      }
   },
  beforeUpdate(){
    console.log("dom:",document.getElementById("age").innerHTML,this.y)
  },
  updated(){
   console.log("dom:",document.getElementById("age").innerHTML,this.y)
  }
}

what is the order of execution?

Jul.02,2022

beforeupdate and updated can see the vue life cycle.


the function body in beforeUpdate,updated should not be executed until the me (a) method is called, because no data update is involved, and then the me function will be executed

.
Menu