Signed-off-by: kerbores <kerbores@gmail.com>
This commit is contained in:
44
develop/front/index.md
Normal file
44
develop/front/index.md
Normal file
@@ -0,0 +1,44 @@
|
||||
<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>
|
||||
|
||||
# 文章归档
|
||||
|
||||
<div class="archive-list">
|
||||
<div v-for="post in posts" :key="post.url" class="post-item">
|
||||
<a :href="post.url">{{ post.title }}</a>
|
||||
<span class="date">{{ post.date.toLocaleDateString() }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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>
|
||||
19
develop/front/posts/2025-08/abcd.md
Normal file
19
develop/front/posts/2025-08/abcd.md
Normal file
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: "VitePress入门指南"
|
||||
date: 2025-08-01
|
||||
tags: ["VitePress", "前端"]
|
||||
---
|
||||
|
||||
# VitePress 入门
|
||||
|
||||
这里是文章内容...
|
||||
|
||||
## 创建项目
|
||||
|
||||
创建项目:w
|
||||
npm create vitepress@latest docs
|
||||
|
||||
## 运行项目
|
||||
|
||||
npm run dev
|
||||
访问地址:http://localhost:5173/
|
||||
Reference in New Issue
Block a user