コンテンツへスキップ

tryOnBeforeMount

カテゴリ
エクスポートサイズ
114 B
最終更新日
先週

安全な`onBeforeMount`。コンポーネントのライフサイクル内にある場合は`onBeforeMount()`を呼び出し、そうでない場合は関数を直接呼び出します。

使用方法

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

ソース

ソースコードドキュメント

コントリビューター

Anthony Fu
Doctorwu
qiang
Eureka

変更ログ

v12.0.0-beta.1 2024/11/21
0a9ed - feat!: Vue 2サポートの削除、バンドルの最適化、クリーンアップ (#4349)
v10.7.1 2023/12/27
ce420 - fix: Vue2での`tryOnMounted`の修正 (#3658)
v10.7.0 2023/12/5
f2aeb - feat(tryOnMounted): target引数のサポート (#3185)

MITライセンスの下でリリースされています。