useHydration 可组合函数在你构建服务器端渲染 (SSR) 应用时很有用(但也适用于非 SSR 构建)。它是 QNoSsr 组件的更底层的工具。
语法
import { useHydration } from 'quasar'
setup () {
const { isHydrated } = useHydration()
}
内容粘贴
function useHydration(): {
isHydrated: Ref<boolean>;
};
内容粘贴
示例
<template>
<div>
<div v-if="isHydrated">
Gets rendered only after hydration.
</div>
</div>
</template>
<script>
import { useHydration } from 'quasar'
export default {
setup () {
const { isHydrated } = useHydration()
return {
isHydrated
}
}
}
</script>
内容粘贴