nextTick — async DOM update. flushSync — sync DOM update.
nextTick:
flushSync:
1<script setup>2import { ref, nextTick, flushSync } from "vue"34const count = ref(0)56async function updateAsync() {7 count.value++8 await nextTick()9 // DOM updated10}1112function updateSync() {13 flushSync(() => {14 count.value++15 })16 // DOM updated immediately17}18</script>
Key: nextTick for async, flushSync for sync.