简单Vue生命周期
0 1

常见 Vue自定义指令的生命周期钩子函数 有哪些?分别说明?

【概念释义】

Vue 自定义指令生命周期钩子:Vue2 为 bind、inserted、update、componentUpdated、unbind;Vue3 对齐组件命名为 created、beforeMount、mounted、beforeUpdate、updated、beforeUnmount、unmounted(简写:mounted、updated、unmounted 最常用)。用于 DOM 操作、第三方库集成、权限禁用按钮等。

【基础使用】

javascript
"qb-hl-comment">// Vue 3
const vFocus = {
  mounted(el) { el.focus(); },

登录查看完整 1171

回答讨论

暂无讨论,登录后可抢先发言

本题库更多题目(50)