diff --git a/packages/theme/src/client/components/BackToTop.vue b/packages/theme/src/client/components/BackToTop.vue index a9c43441..02b2cd0e 100644 --- a/packages/theme/src/client/components/BackToTop.vue +++ b/packages/theme/src/client/components/BackToTop.vue @@ -16,6 +16,7 @@ const scrollToTop = (): void => { } onMounted(() => { + if (__VUEPRESS_SSR__) return canShow() window.addEventListener('scroll', () => canShow(), false) }) diff --git a/packages/theme/src/client/components/BlogInfo.vue b/packages/theme/src/client/components/BlogInfo.vue index 3d6217b5..988e3835 100644 --- a/packages/theme/src/client/components/BlogInfo.vue +++ b/packages/theme/src/client/components/BlogInfo.vue @@ -1,8 +1,16 @@ diff --git a/packages/theme/src/client/components/BloggerInfo.vue b/packages/theme/src/client/components/BloggerInfo.vue index d5d58da6..f358634b 100644 --- a/packages/theme/src/client/components/BloggerInfo.vue +++ b/packages/theme/src/client/components/BloggerInfo.vue @@ -2,7 +2,7 @@ import DropdownTransition from '@theme-plume/DropdownTransition.vue' import { isLinkHttp, isLinkMailto } from '@vuepress/shared' import type { FunctionalComponent, Ref } from 'vue' -import { ref } from 'vue' +import { computed, ref } from 'vue' import { usePostStat, useThemeLocaleData } from '../composables' import { EmailIcon, @@ -26,11 +26,11 @@ type SocialData = SocialItem[] type SocialRef = Ref const themeLocale = useThemeLocaleData() -const avatar = themeLocale.value.avatar || {} -const social = themeLocale.value.social || {} +const avatar = computed(() => themeLocale.value.avatar || {}) const useSocialList = (): SocialRef => { const list: SocialRef = ref([]) + const social = themeLocale.value.social || {} if (social.QQ) { const url = isLinkHttp(social.QQ) ? social.QQ diff --git a/packages/theme/src/client/components/PostList.vue b/packages/theme/src/client/components/PostList.vue index 594a344d..dce5fa6a 100644 --- a/packages/theme/src/client/components/PostList.vue +++ b/packages/theme/src/client/components/PostList.vue @@ -3,7 +3,7 @@ import DropdownTransition from '@theme-plume/DropdownTransition.vue' import PostItem from '@theme-plume/PostItem.vue' import { usePageFrontmatter } from '@vuepress/client' import type { PropType } from 'vue' -import { toRefs, watch } from 'vue' +import { nextTick, onMounted, toRefs, watch } from 'vue' import { onBeforeRouteUpdate, useRoute, useRouter } from 'vue-router' import type { PlumeThemeHomeFrontmatter } from '../../shared' import type { PostListData } from '../composables' @@ -49,7 +49,11 @@ onBeforeRouteUpdate((to) => { setTimeout(() => scrollTo(document, top), 0) }) -setPostListPage((route.query.p as unknown as number) || 1) +onMounted(async () => { + if (__VUEPRESS_SSR__) return + await nextTick() + setPostListPage((route.query.p as unknown as number) || 1) +}) const togglePage = (currentPage: number): void => { router.push({ path: route.path, diff --git a/packages/theme/src/client/styles/_variables.scss b/packages/theme/src/client/styles/_variables.scss index 2b91feb5..948203a9 100644 --- a/packages/theme/src/client/styles/_variables.scss +++ b/packages/theme/src/client/styles/_variables.scss @@ -4,8 +4,8 @@ $MQNarrow: 959px !default; $MQMobile: 719px !default; $MQMobileNarrow: 419px !default; -$containerWith: 1024px !default; +$containerWith: 1200px !default; -$codeLang: 'c' 'cpp' 'cs' 'dart' 'docker' 'fs' 'go' 'java' 'kt' 'makefile' - 'css' 'less' 'sass' 'scss' 'styl' 'html' 'js' 'json' 'ts' 'vue' 'jsx' - 'md' 'php' 'py' 'rb' 'rs' 'sh' 'toml' 'yml' !default; +$codeLang: 'c' 'cpp' 'cs' 'dart' 'docker' 'fs' 'go' 'java' 'kt' 'makefile' 'css' + 'less' 'sass' 'scss' 'styl' 'html' 'js' 'json' 'ts' 'vue' 'jsx' 'md' 'php' + 'py' 'rb' 'rs' 'sh' 'toml' 'yml' !default;