Skip to content

Commit

Permalink
✨ Add articles menu (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
BeiyanYunyi authored and LittleSound committed Mar 13, 2024
1 parent 1dd3c93 commit 472699c
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
5 changes: 1 addition & 4 deletions docs/.vitepress/components.d.ts
Expand Up @@ -9,11 +9,8 @@ declare module 'vue' {
export interface GlobalComponents {
AppearanceToggle: typeof import('./theme/components/AppearanceToggle.vue')['default']
AppSBox: typeof import('./theme/components/AppSBox.vue')['default']
ArticlesMenu: typeof import('./theme/components/ArticlesMenu.vue')['default']
HomeContent: typeof import('./theme/components/HomeContent.vue')['default']
PageInfo: typeof import('./theme/components/PageInfo.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Starport: typeof import('vue-starport')['Starport']
StarportCarrier: typeof import('vue-starport')['StarportCarrier']
}
}
13 changes: 13 additions & 0 deletions docs/.vitepress/theme/components/ArticlesMenu.vue
@@ -0,0 +1,13 @@
<script setup lang="ts">
import { useRoute } from "vitepress";
import { data } from "./articlesmenu.data";
const route = useRoute();
</script>

<template>
<ul>
<li v-for="article in data.menu[route.path].items" :key="article.link">
<a :href="article.link">{{ article.text }}</a>
</li>
</ul>
</template>
14 changes: 14 additions & 0 deletions docs/.vitepress/theme/components/articlesmenu.data.ts
@@ -0,0 +1,14 @@
import { sidebar } from "../../sidebar";

declare const data: {
menu: {
[key: string]: { base: string; items: { text: string; link: string }[] };
};
};
export { data };

export default {
load() {
return { menu: sidebar };
},
};
4 changes: 4 additions & 0 deletions docs/campus/index.md
Expand Up @@ -13,3 +13,7 @@ category:
民间有对各个大学的生活质量的问卷结果可以在 [colleges.chat](https://colleges.chat) 查阅

投稿指南请看 [这里](../contributor-guide/campus.html)

## 大学目录

<ArticlesMenu />
4 changes: 4 additions & 0 deletions docs/personal-safety/index.md
Expand Up @@ -7,3 +7,7 @@ index: false
---

针对女性 / 性少数的暴力是一个社会性的问题。作为性少数,有必要了解一些防护的方法,以保护自己和他人的人身安全。

## 文章目录

<ArticlesMenu />

0 comments on commit 472699c

Please sign in to comment.