Skip to content

Commit fa84f25

Browse files
committed
fix: guard for SSR
1 parent aff6313 commit fa84f25

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/.vitepress/theme/glare-card/glare-card.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ import Card from './card.vue'
8282
const model = defineModel({ default: false })
8383
8484
watch(model, (value) => {
85+
if (typeof window === 'undefined') return
86+
8587
if (value) {
8688
document.documentElement.classList.add('overflow-hidden')
8789
document.body.classList.add('overflow-hidden')
@@ -92,6 +94,8 @@ watch(model, (value) => {
9294
}, { immediate: true })
9395
9496
onBeforeUnmount(() => {
97+
if (typeof window === 'undefined') return
98+
9599
document.documentElement.classList.remove('overflow-hidden')
96100
document.body.classList.remove('overflow-hidden')
97101
})

0 commit comments

Comments
 (0)