Skip to content

Vue 3 safe onMounted working inside and outside setup

Notifications You must be signed in to change notification settings

vuefrag/vue-try-on-mounted

Repository files navigation

vue-try-on-mounted

vue-try-on-mounted

A Vue 3 composition API utility that safely calls onMounted when inside component setup context, and gracefully handles calls outside setup without errors.

npm version npm downloads

Installation

npm install vue-try-on-mounted

Usage

import { tryOnMounted } from 'vue-try-on-mounted'

tryOnMounted(() => {
  console.log('Component mounted')
})

console.log('Mount handler registered')

License

MIT

Extracted from VueUse for standalone use.

About

Vue 3 safe onMounted working inside and outside setup

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published