Skip to content

tryOnBeforeUnmount

Category
Export Size
148 B
Last Changed
3 hours ago

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

用法

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

tryOnBeforeUnmount(() => {

})

Type Declarations

typescript
/**
 * Call onBeforeUnmount() if it's inside a component lifecycle, if not, do nothing
 *
 * @param fn
 * @param target
 */
export declare function tryOnBeforeUnmount(fn: Fn, target?: any): void

Source

SourceDocs

Contributors

jorshen

Changelog

No recent changes

Released under the MIT License.