Skip to content

Vue Composition API: nextTick

Declan Coughlan edited this page May 30, 2023 · 2 revisions

Class Component

    async mounted(): Promise<void> {
        await this.$nextTick();
        
        //...perform additional actions
    }

Composition API

import { nextTick, onMounted } from "vue";
onMounted(async () => {
    await nextTick();
    
    //...perform additional actions
});

To attach to the created lifecycle hook (Vue 2.7, doesn't accept async in <script setup>) place the call directly within the <script> tag

nextTick(() => {
  // ... perform aditional actions in callback
});

Documentation

Clone this wiki locally