Skip to content

useMounted

参考文献中的安装状态。

¥Mounted state in ref.

示例

unmounted

用法

¥Usage

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

const isMounted = useMounted()

这本质上是以下内容的简写:

¥Which is essentially a shorthand of:

ts
const isMounted = ref(false)

onMounted(() => {
  isMounted.value = true
})

类型声明

typescript
/**
 * Mounted state in ref.
 *
 * @see https://vueuse.org/useMounted
 */
export declare function useMounted(): Ref<boolean>

源代码

源代码示例文档

变更日志

No recent changes

VueUse 中文网 - 粤ICP备13048890号