tryOnMounted
安全な `onMounted` です。コンポーネントのライフサイクル内であれば `onMounted()` を呼び出し、そうでない場合は単に関数を呼び出します。
使用方法
js
import { tryOnMounted } from '@vueuse/core'
tryOnMounted(() => {
})
型宣言
typescript
/**
* Call onMounted() if it's inside a component lifecycle, if not, just call the function
*
* @param fn
* @param sync if set to false, it will run in the nextTick() of Vue
* @param target
*/
export declare function tryOnMounted(fn: Fn, sync?: boolean, target?: any): void