来自大厂 10+ 前端面试题附答案(整理版)_2023-03-15

2023-03-15 13:13:55 浏览数 (3)

  • beforeDestroy: 销毁开始
  • 销毁自身且递归销毁子组件以及事件监听
    • remove(): 删除节点
    • watcher.teardown(): 清空依赖
    • vm.$off(): 解绑监听
  • destroyed: 完成后触发钩子

Vue2

Vue3

beforeCreate

setup(替代)

created

setup(替代)

beforeMount

onBeforeMount

mounted

onMounted

beforeUpdate

onBeforeUpdate

updated

nUpdated

beforeDestroy

onBeforeUnmount

destroyed

onUnmounted

errorCaptured

onErrorCaptured

0 人点赞