mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
33 lines
833 B
Vue
33 lines
833 B
Vue
<script lang="ts" setup>
|
|
import { useArchivesList } from '../composables/useArchives'
|
|
import { dayjs } from '../utils/dayjs'
|
|
|
|
const archivesList = useArchivesList()
|
|
|
|
const format = (date: string | number | undefined): string => {
|
|
return dayjs(date).format('MM-DD')
|
|
}
|
|
</script>
|
|
<template>
|
|
<div class="archives-list-wrapper">
|
|
<h2>归档</h2>
|
|
<div
|
|
v-for="archives in archivesList"
|
|
:key="archives.label"
|
|
class="archives-list-container"
|
|
>
|
|
<h3>{{ archives.label }}</h3>
|
|
<ul>
|
|
<li
|
|
v-for="post in archives.postList"
|
|
:key="post.path"
|
|
class="archives-item"
|
|
>
|
|
<span>[{{ format(post.frontmatter.createTime) }}]</span>
|
|
<RouterLink :to="post.path">{{ post.title }}</RouterLink>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</template>
|