Skip to content

tryOnBeforeMount

安全 onBeforeMount。如果它在组件生命周期内,则调用 onBeforeMount(),如果不在组件生命周期内,则仅调用该函数

¥Safe onBeforeMount. Call onBeforeMount() if it's inside a component lifecycle, if not, just call the function

用法

¥Usage

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

tryOnBeforeMount(() => {

})

类型声明

typescript
/**
 * Call onBeforeMount() if it's inside a component lifecycle, if not, just call the function
 *
 * @param fn
 * @param sync if set to false, it will run in the nextTick() of Vue
 * @param target
 */
export declare function tryOnBeforeMount(
  fn: Fn,
  sync?: boolean,
  target?: any,
): void

源代码

源代码文档

变更日志

No recent changes

VueUse 中文网 - 粤ICP备13048890号