📜  vue js hooks - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:13.246000             🧑  作者: Mango

代码示例1
beforeUpdate(){
///beforeUpdate: Called when data changes, before the DOM is patched
}

mounted() {
  this.$nextTick(function () {
    // Code that will run only after the
    // entire view has been rendered
  })
}

updated() {
  this.$nextTick(function () {
    // Code that will run only after the
    // entire view has been re-rendered
  })
}
//others are
//beforeUpdate : Called when data changes, before the DOM is patched. 
//activated : Called when a kept-alive component is activated.
// deactivated : Called when a kept-alive component is deactivated.
// beforeUnmount : Called right before a component instance is unmounted. At this stage the instance is still fully functional.
// unmounted : Called after a component instance has been unmounted.