优化:《我的归档》筛选功能

This commit is contained in:
2022-08-12 19:03:36 +08:00
parent 0696bd5295
commit 82a5a8207e
2 changed files with 112 additions and 63 deletions

View File

@@ -26,7 +26,7 @@
</span>
<span class="meta-content">
<span v-for="(category, index) in categories" :key="index">
<a :href="'/archives.html?category=' + category" target="_self">{{ category }}</a>
<a href="javascript:void(0);" @click="router.go('/archives.html?category=' + category)" target="_self" title="按分类归档">{{ category }}</a>
<span v-if="index != categories.length - 1">, </span>
</span>
</span>
@@ -37,7 +37,7 @@
</span>
<span class="meta-content">
<span v-for="(tag, index) in tags" :key="index">
<a :href="'/archives.html?tag=' + tag" target="_self">{{ tag }}</a>
<a href="javascript:void(0);" @click="router.go('/archives.html?tag=' + tag)" target="_self" title="按标签归档">{{ tag }}</a>
<span v-if="index != tags.length - 1">, </span>
</span>
</span>
@@ -47,7 +47,7 @@
<script lang="ts" setup>
import { reactive, toRefs } from 'vue'
import { useData } from 'vitepress'
import { useData, useRouter } from 'vitepress'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
import relativeTime from 'dayjs/plugin/relativeTime'
@@ -55,6 +55,8 @@ import relativeTime from 'dayjs/plugin/relativeTime'
dayjs.extend(relativeTime)
dayjs.locale('zh-cn')
const router = useRouter()
// 定义文章属性
const props = defineProps({
article: Object,