Vue: getting started

Lesson 08 · 12 min

onMounted and loading

After it appears in the DOM — onMounted. Fetch there, or in a watch on the id.

12 minLesson 8 of 8Practice includedAsk AI on any point

onMounted(() => { … }) — the component is already in the document. DOM measurements and the initial load go here. onUnmounted clears a timer. A changing id from a prop needs watch, not just mount: otherwise switching the user on the same screen won't load the data.

Sign in to continue

The rest of this lesson opens after sign up

The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.