修改分享到微信按钮至HeaderLinks

组件.  并修改博客文章头样式,加入日期显示
This commit is contained in:
2025-08-10 16:01:03 +08:00
parent 85863cb249
commit c557e6980c
5 changed files with 117 additions and 40 deletions

View File

@@ -70,6 +70,7 @@ defineOgImageComponent('Docs', {
headline: headline.value
})
const editLink = computed(() => {
if (!appConfig.github) {
return
@@ -99,14 +100,14 @@ const links = computed(() => {
return [...links, ...(appConfig.toc?.bottom?.links || [])].filter(Boolean)
})
// ===== 微信分享(测试按钮用)=====
const wxShareActive = ref(false)
// const contentRoot = ref<HTMLElement | null>(null)
// // ===== 微信分享(测试按钮用)=====
// const wxShareActive = ref(false)
// // const contentRoot = ref<HTMLElement | null>(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 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<string>('/images/default-blog.jpg')
// onMounted(() => {
@@ -118,17 +119,17 @@ const shareImg = page?.value?.img
// }
// })
// Toast点击测试分享后给出指引
const toast = useToast()
function handleShareClick() {
wxShareActive.value = true
toast.add({
title: '已获取分享接口',
description: '点击右上角分享吧',
duration: 3000,
icon: 'i-lucide-share-2'
})
}
// // Toast点击测试分享后给出指引
// const toast = useToast()
// function handleShareClick() {
// wxShareActive.value = true
// toast.add({
// title: '已获取分享接口',
// description: '点击右上角分享吧',
// duration: 3000,
// icon: 'i-lucide-share-2'
// })
// }
</script>
<template>
@@ -144,6 +145,7 @@ function handleShareClick() {
wrapper: 'flex-row items-center flex-wrap justify-between '
}"
>
<span v-if="page" class="text-sm text-pretty text-muted mt-4"> {{ page.date }} </span>
<template #links>
<UButton
v-for="(link, index) in page.links"
@@ -178,7 +180,7 @@ function handleShareClick() {
编辑页面
</UButton>
or
<!-- <UButton
<UButton
variant="link"
color="neutral"
:to="`${appConfig.github.url}/issues/new/choose`"
@@ -187,9 +189,9 @@ function handleShareClick() {
:ui="{ leadingIcon: 'size-4' }"
>
提交问题
</UButton> -->
</UButton>
<UButton
<!-- <UButton
variant="link"
color="neutral"
icon="lucide-share-2"
@@ -197,19 +199,19 @@ function handleShareClick() {
@click="handleShareClick()"
>
微信分享
</UButton>
</UButton> -->
</div>
</USeparator>
<UContentSurround :surround="surround" />
<!-- 激活后挂载分享组件无可视内容 -->
<!-- 激活后挂载分享组件无可视内容
<SharedWxShare
v-if="wxShareActive"
:url="shareLink"
:title="shareTitle"
:desc="shareDesc"
:img-url="shareImg"
/>
/> -->
</UPageBody>
<template