nextTick — after DOM update. setTimeout — arbitrary delay.
nextTick:
setTimeout:
1<script setup>2import { ref, nextTick } from "vue"34const el = ref(null)56async function scrollToBottom() {7 el.value.scrollTop = el.value.scrollHeight8 await nextTick()9 // DOM is updated now10}11</script>
Key: nextTick for DOM access after update.