From 645da2f94561eeb5f4d6db41d44c38e909e45fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Mon, 2 Jan 2023 04:43:09 +0800 Subject: [PATCH] fix: omit value property of isHydrated in template (#681) --- components/publish/PublishAttachment.vue | 4 ++-- composables/hydration.ts | 14 ++++---------- layouts/default.vue | 4 ++-- pages/[[server]]/explore/index.vue | 2 +- pages/[[server]]/explore/links.vue | 2 +- pages/[[server]]/explore/tags.vue | 2 +- pages/settings.vue | 4 ++-- pages/settings/profile/appearance.vue | 2 ++ 8 files changed, 15 insertions(+), 19 deletions(-) diff --git a/components/publish/PublishAttachment.vue b/components/publish/PublishAttachment.vue index c09dc72a..35adc068 100644 --- a/components/publish/PublishAttachment.vue +++ b/components/publish/PublishAttachment.vue @@ -31,11 +31,11 @@ const toggleApply = () => { v-if="removable" :aria-label="$t('attachment.remove_label')" hover:bg="gray/40" transition-100 p-1 rounded-5 cursor-pointer - :class="[isHydrated.value && isSmallScreen ? '' : 'op-0 group-hover:op-100hover:']" + :class="[isHydrated && isSmallScreen ? '' : 'op-0 group-hover:op-100hover:']" mix-blend-difference @click="$emit('remove')" > -
+
diff --git a/composables/hydration.ts b/composables/hydration.ts index 84ead784..98fad034 100644 --- a/composables/hydration.ts +++ b/composables/hydration.ts @@ -1,14 +1,8 @@ -export const isHydrated = computed(() => { - if (process.server) - return { value: false } +export const isHydrated = ref(false) +if (!process.server) { const nuxtApp = useNuxtApp() - if (!nuxtApp.isHydrating) - return { value: false } - - const hydrated = ref(false) nuxtApp.hooks.hookOnce('app:suspense:resolve', () => { - hydrated.value = true + isHydrated.value = true }) - return hydrated -}) +} diff --git a/layouts/default.vue b/layouts/default.vue index 390b767b..e3b19dbe 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -45,8 +45,8 @@ const wideLayout = computed(() => route.meta.wideLayout ?? false)
- - + +