feat: 文章标签展示、搜索框清除按钮
- 文章详情页和文章卡片展示标签 - 搜索框右侧添加 × 清除按钮 - 标签点击跳转文章列表页自动搜索 - 修复 hasAnyFilter 未包含 tags 的 bug Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { siteConfig } from '~/config/site'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const slug = route.params.slug as string
|
||||
|
||||
@@ -52,6 +53,17 @@ function formatDate(date: string) {
|
||||
{{ post.description }}
|
||||
</p>
|
||||
|
||||
<div v-if="post.tags?.length" class="mt-4 flex flex-wrap gap-2">
|
||||
<span
|
||||
v-for="tag in post.tags"
|
||||
:key="tag"
|
||||
class="tag-pill cursor-pointer"
|
||||
@click="router.push(`/posts?tag=${encodeURIComponent(tag)}`)"
|
||||
>
|
||||
{{ tag }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div v-if="post.image" class="mt-6">
|
||||
<img
|
||||
:src="post.image"
|
||||
|
||||
Reference in New Issue
Block a user