Skip to content

tryOnScopeDispose

安全 onScopeDispose。如果 onScopeDispose() 在效果范围生命周期内,则调用 onScopeDispose(),如果不在,则不执行任何操作

¥Safe onScopeDispose. Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing

用法

¥Usage

js
import { tryOnScopeDispose } from '@vueuse/core'

tryOnScopeDispose(() => {

})

类型声明

typescript
/**
 * Call onScopeDispose() if it's inside an effect scope lifecycle, if not, do nothing
 *
 * @param fn
 */
export declare function tryOnScopeDispose(fn: Fn): boolean

源代码

源代码文档

变更日志

No recent changes

VueUse 中文网 - 粤ICP备13048890号