From 06de0f2b337728508b3f32f61ebcdffff4c6bd13 Mon Sep 17 00:00:00 2001 From: estel <690930@qq.com> Date: Sun, 10 Aug 2025 16:38:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=86=E4=BA=AB=E4=BC=A0?= =?UTF-8?q?=E9=80=92=E5=8F=82=E6=95=B0,=E6=B8=85=E7=90=86=E6=B3=A8?= =?UTF-8?q?=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/components/docs/DocsPageHeaderLinks.vue | 12 +++++- app/pages/blog/[...slug].vue | 47 +++------------------ 2 files changed, 15 insertions(+), 44 deletions(-) diff --git a/app/components/docs/DocsPageHeaderLinks.vue b/app/components/docs/DocsPageHeaderLinks.vue index f00d475..9aa16da 100644 --- a/app/components/docs/DocsPageHeaderLinks.vue +++ b/app/components/docs/DocsPageHeaderLinks.vue @@ -2,6 +2,12 @@ import { useClipboard } from '@vueuse/core' import WxShare from '~/components/shared/wxShare.vue' +const props = defineProps<{ + title?: string + desc?: string + imgUrl?: string +}>() + const route = useRoute() const toast = useToast() const { copy, copied } = useClipboard() @@ -15,8 +21,9 @@ const markdownLink = computed(() => `${origin.value}/raw${decodeURIComponent(rou const enableWxShare = ref(false) -const shareTitle = computed(() => (import.meta.client ? (document.title || 'Estel Docs') : '')) -const shareDesc = computed(() => (import.meta.client ? (document.title || 'Estel Docs') : '')) +const shareTitle = computed(() => props.title ?? (import.meta.client ? (document.title || 'Estel Docs') : '')) +const shareDesc = computed(() => props.desc ?? (import.meta.client ? (document.title || 'Estel Docs') : '')) +const shareImg = computed(() => props.imgUrl ?? '/images/default-blog.jpg') const items = [ { @@ -106,6 +113,7 @@ const items = [ :url="mdcLink" :title="shareTitle" :desc="shareDesc" + :img-url="shareImg" /> diff --git a/app/pages/blog/[...slug].vue b/app/pages/blog/[...slug].vue index 6a35c77..0bdf774 100644 --- a/app/pages/blog/[...slug].vue +++ b/app/pages/blog/[...slug].vue @@ -98,37 +98,6 @@ const links = computed(() => { return [...links, ...(appConfig.toc?.bottom?.links || [])].filter(Boolean) }) - -// // ===== 微信分享(测试按钮用)===== -// const wxShareActive = ref(false) -// // const contentRoot = ref(null) - -// const shareLink = computed(() => 'https://lijue.me' + decodeURIComponent(path.value)) -// const shareTitle = computed(() => title) -// const shareDesc = computed(() => description || title) -// const shareImg = page?.value?.img -// const shareImg = ref('/images/default-blog.jpg') - -// onMounted(() => { -// // 从正文中抓取第一张图片作为分享图 -// const el = contentRoot.value -// const firstImg = el?.querySelector('img') as HTMLImageElement | null -// if (firstImg?.src) { -// shareImg.value = firstImg.src -// } -// }) - -// // Toast:点击测试分享后给出指引 -// const toast = useToast() -// function handleShareClick() { -// wxShareActive.value = true -// toast.add({ -// title: '已获取分享接口', -// description: '点击右上角分享吧', -// duration: 3000, -// icon: 'i-lucide-share-2' -// }) -// } @@ -192,16 +165,6 @@ const links = computed(() => { > 提交问题 - -