Skip to content

Vue3 生命周期基础知识

基础知识

Options 生命周期
  • beforeCreate
  • created
  • beforeMount
  • mounted
  • beforeUpdate
  • updated
  • beforeUnmount
  • unmounted
  • errorCaptured
  • renderTracked
  • renderTriggered
  • activated
  • deactivated
  • serverPrefetch
Composition 生命周期
  • onMounted()
  • onUpdated()
  • onUnmounted()
  • onBeforeMount()
  • onBeforeUpdate()
  • onBeforeUnmount()
  • onErrorCaptured()
  • onRenderTracked()
  • onRenderTriggered()
  • onActivated()
  • onDeactivated()
  • onServerPrefetch()

生命周期图

下图展示了实例的生命周期。