From 3a787897ab925d4e1c2b20ec84f62ae3a6babcdf Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Wed, 11 Sep 2024 02:26:35 +0800 Subject: [PATCH] perf(theme): optimize profile avatar --- .../client/components/Blog/VPBlogProfile.vue | 7 ++- theme/src/client/styles/md-enhance.css | 14 +++--- theme/src/node/prepare/prepareThemeData.ts | 47 ++++++++++++++++++- theme/src/node/theme.ts | 4 +- 4 files changed, 58 insertions(+), 14 deletions(-) diff --git a/theme/src/client/components/Blog/VPBlogProfile.vue b/theme/src/client/components/Blog/VPBlogProfile.vue index daf8455c..38ed58f6 100644 --- a/theme/src/client/components/Blog/VPBlogProfile.vue +++ b/theme/src/client/components/Blog/VPBlogProfile.vue @@ -4,9 +4,12 @@ import { computed } from 'vue' import { withBase } from 'vuepress/client' import { isLinkHttp } from 'vuepress/shared' import { useData } from '../../composables/index.js' +import type { PlumeThemeProfile } from '../../../shared/index.js' const { theme } = useData() -const profile = computed(() => theme.value.profile) +const profile = computed(() => + theme.value.profile as PlumeThemeProfile & { originalWidth?: number, originalHeight?: number }, +) const imageUrl = computed(() => { const url = profile.value?.avatar ?? profile.value?.url if (!url) @@ -20,7 +23,7 @@ const imageUrl = computed(() => {