Skip to content

useMounted ​

类别
导出大小
122 B
最近修改
7 months ago

参考文献中的安装状态。

🌐 Mounted state in ref.

示例 ​

用法 ​

🌐 Usage

ts
import { 
useMounted
} from '@vueuse/core'
const
isMounted
=
useMounted
()

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

🌐 Which is essentially a shorthand of:

ts
const 
isMounted
=
ref
(false)
onMounted
(() => {
isMounted
.
value
= true
})
js
'use strict'
const isMounted = ref(false)
onMounted(() => {
  isMounted.value = true
})