Some checks failed
Release / Release (push) Failing after 26s
Signed-off-by: kerbores <kerbores@gmail.com>
979 B
979 B
<script setup>
import { ref, onMounted,inject } from 'vue'
const posts = ref([])
const tags = inject('tags')
onMounted(async () => {
const allPosts = import.meta.glob('./posts/**/*.md', { eager: true })
posts.value = Object.keys(allPosts).map(path => {
const post = allPosts[path].__pageData
return {
title: post.frontmatter.title,
date: new Date(post.frontmatter.date),
tags: post.frontmatter.tags,
url: path.replace('.md', '')
}
}).sort((a, b) => b.date - a.date)
})
</script>
<style scoped>
.archive-list {
max-width: 800px;
margin: 0 auto;
}
.post-item {
margin-bottom: 1rem;
padding: 1rem;
border-bottom: 1px solid #eee;
}
.date {
float: right;
color: #666;
}
</style>
文章归档
{{ post.title }}
{{ post.date.toLocaleDateString() }}