Skip to content

tryOnUnmounted

安全 onUnmounted。如果 onUnmounted() 在组件生命周期内,则调用 onUnmounted(),如果不在组件生命周期内,则不执行任何操作

¥Safe onUnmounted. Call onUnmounted() if it's inside a component lifecycle, if not, do nothing

用法

¥Usage

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

源代码

源代码文档

变更日志

No recent changes

VueUse 中文网 - 粤ICP备13048890号