vm.$nextTick( callback )
-
Arguments:
{Function} [callback]
-
Usage:
Defer the callback to be executed after the next DOM update cycle. Use it immediately after you’ve changed some data to wait for the DOM update. This is the same as the global
Vue.nextTick
, except that the callback’sthis
context is automatically bound to the instance calling this method. -
Example:
12345678910111213141516new
Vue({
// ...
methods: {
// ...
example:
function
() {
// modify data
this
.message =
'changed'
// DOM is not updated yet
this
.$nextTick(
function
() {
// DOM is now updated
// `this` is bound to the current instance
this
.doSomethingElse()
})
}
}
})
-
See also:
- Vue.nextTick
- Async Update Queue
Please login to continue.