I have been relying on this for a significant part of a QA application I have been writing. Will this be available in some form or another in Vue 3? or should I begin rewriting things in .then()?
Thanks
Defer the callback to be executed after the next DOM update cycle. Use it immediately after you鈥檝e changed some data to wait for the DOM update. This is the same as the global
Vue.nextTick, except that the callback鈥檚 this context is automatically bound to the instance calling this method.
I am not sure if it will be available in the Vue 3 API, but now it is available through the context.root element in this API.
setup(_, { root }) {
root.$nextTick(() => console.log('hi'));
}
I am not sure if it will be available in the Vue 3 API, but now it is available through the context.root element in this API.
setup(_, { root }) { root.$nextTick(() => console.log('hi')); }
thanks, still better than my solution of importing Vue to call Vue.nextTick(()=>{})
FYI, importing Vue to call Vue.nextTick is totally fine as a solution.
Not sure about how the usage of nextTick will be on v3 but it may be through a named import
Since root is part of the context and $nextTick is probably not going away, I would say using root.$nextTick is safe
Most helpful comment
FYI, importing Vue to call
Vue.nextTickis totally fine as a solution.Not sure about how the usage of
nextTickwill be on v3 but it may be through a named importSince
rootis part of the context and$nextTickis probably not going away, I would say usingroot.$nextTickis safe