We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
beforeCreate
created
beforeMount
mounted
beforeUpdate
updated
由于数据更改导致的虚拟 DOM 重新渲染和打补丁,在这之后会调用该钩子。
当这个钩子被调用时,组件 DOM 已经更新,所以你现在可以执行依赖于 DOM 的操作。然而在大多数情况下,你应该避免在此期间更改状态,因为这可能会导致更新无限循环。
该钩子在服务器端渲染期间不被调用。
beforeDestroy
destroyed
Vue.nextTick(function () { // DOM 更新了 })
created() { setTimeout(() => { this.number = 100 this.$nextTick(() => { console.log('nextTick', document.getElementsByTagName('p')[0]) }) },100) }
生命周期钩子的一些使用方法:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Vue生命周期
生命周期
钩子函数
beforeCreate
created
beforeMount
mounted
beforeUpdate
updated
由于数据更改导致的虚拟 DOM 重新渲染和打补丁,在这之后会调用该钩子。
当这个钩子被调用时,组件 DOM 已经更新,所以你现在可以执行依赖于 DOM 的操作。然而在大多数情况下,你应该避免在此期间更改状态,因为这可能会导致更新无限循环。
该钩子在服务器端渲染期间不被调用。
beforeDestroy
destroyed
Vue.nextTick
生命周期小结
生命周期钩子的一些使用方法:
更多
The text was updated successfully, but these errors were encountered: