主题
useMounted
参考文献中的安装状态。
🌐 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
})