|
5 | 5 | :style="{ backgroundImage: `url(${ bgList[0] })` }" |
6 | 6 | > |
7 | 7 | <slot name="homePage"> |
8 | | - <div class="w-80vw max-w-800px mb-8vh h-a flex-center flex-col rounded-xl py-10"> |
| 8 | + <div class="w-80vw max-w-800px mb-12vh h-a flex-center flex-col rounded-xl py-10"> |
9 | 9 | <div class="relative w-60 h-60 max-w-80vw max-h-80vw" @click="goPage(aboutMePath)"> |
10 | 10 | <img class="w-full w-full rounded-sm cursor-pointer" :src="logo" alt=""/> |
11 | 11 | </div> |
|
49 | 49 | <script setup lang="ts"> |
50 | 50 | import NanoContainer from '@NanoUI/NanoContainer/index.vue'; |
51 | 51 | import { useData, useRouter } from 'vitepress'; |
52 | | - import { computed, ref, watch } from 'vue'; |
| 52 | + import { computed, onMounted, onUnmounted, ref, watch } from 'vue'; |
53 | 53 | import { DefaultTheme } from 'vitepress/types/default-theme'; |
| 54 | + import { controllerStore } from '@store/controller'; |
54 | 55 |
|
55 | 56 | const { frontmatter, site } = useData(); |
56 | 57 |
|
|
84 | 85 | watch(() => frontmatter.value.layout, (value) => { |
85 | 86 | onlyShowIndex.value = value === 'home'; |
86 | 87 | }, { immediate: true, deep: true }); |
| 88 | +
|
| 89 | + const ctl = controllerStore(); |
| 90 | + const resizeObserver = ref<ResizeObserver | null>(null); |
| 91 | +
|
| 92 | + onMounted(() => { |
| 93 | + const htmlEl = document.documentElement!; |
| 94 | + resizeObserver.value = new ResizeObserver((entries: ResizeObserverEntry[]) => { |
| 95 | + for (const entry of entries) { |
| 96 | + const { target } = entry; |
| 97 | + const { clientWidth } = target as HTMLElement; |
| 98 | + if (clientWidth < 960) { |
| 99 | + ctl.onlyFullscreen = true; |
| 100 | + } else { |
| 101 | + ctl.onlyFullscreen = false; |
| 102 | + } |
| 103 | + } |
| 104 | + }); |
| 105 | + resizeObserver.value.observe(htmlEl); |
| 106 | + }); |
| 107 | +
|
| 108 | + onUnmounted(() => { |
| 109 | + resizeObserver.value?.disconnect(); |
| 110 | + }); |
87 | 111 | </script> |
88 | 112 |
|
89 | 113 | <style lang="scss"> |
|
0 commit comments