tryOnUnmounted
安全な onUnmounted
。コンポーネントライフサイクル内にある場合はonUnmounted()
を呼び出し、そうでない場合は何もしません
使用方法
js
import { tryOnUnmounted } from '@vueuse/core'
tryOnUnmounted(() => {
})
型宣言
typescript
/**
* Call onUnmounted() if it's inside a component lifecycle, if not, do nothing
*
* @param fn
* @param target
*/
export declare function tryOnUnmounted(fn: Fn, target?: any): void