Tracks the mounted state of a component.
A readonly reference that is false initially and true after the component is mounted.
false
true
const mounted = useMounted() watchEffect(() => { if (mounted.value) { console.log('Component mounted') } }) Copy
const mounted = useMounted() watchEffect(() => { if (mounted.value) { console.log('Component mounted') } })
Tracks the mounted state of a component.