Composition-api: this.nextTick()

Created on 10 Jul 2019  路  4Comments  路  Source: vuejs/composition-api

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

question

Most helpful comment

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

All 4 comments

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.

https://vuejs.org/v2/api/#Vue-nextTick

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sseeland picture sseeland  路  4Comments

mbbbc picture mbbbc  路  6Comments

SJanJan picture SJanJan  路  3Comments

banricho picture banricho  路  3Comments

SeregPie picture SeregPie  路  6Comments