Vue.js · Function
onMounted
onMounted() registers a callback that runs after a Vue component is mounted. Use it for work that needs the component's rendered DOM, such as reading a template ref or starting a browser-side effect.
Last updated
Syntax
function onMounted(callback: () => void, target?: ComponentInternalInstance | null): voidIn-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
onBeforeMount()onUpdated()onUnmounted()onBeforeUnmount()onServerPrefetch()nextTick()Lifecycle Hooks