Skip to content
masterclass Buddy

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): void

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • onBeforeMount()
  • onUpdated()
  • onUnmounted()
  • onBeforeUnmount()
  • onServerPrefetch()
  • nextTick()
  • Lifecycle Hooks

Source: Composition API: Lifecycle Hooks. Checked 2026-11-03.