Skip to content

tryOnUnmounted ​

Category
Export Size
144 B
Last Changed
6 minutes ago

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

用法 ​

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

tryOnUnmounted(() => {

})

Type Declarations ​

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

Source ​

Source • Docs

Contributors ​

jojo

Changelog ​

No recent changes

Released under the MIT License.