diff --git a/package.json b/package.json index 92bb0142f..cf33e8d64 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "vitepress": "^1.0.0-alpha.4" }, "dependencies": { + "@arco-design/web-vue": "^2.34.1", "blueimp-md5": "^2.19.0", "dayjs": "^1.11.4", "element-plus": "^2.2.9", diff --git a/repos/.vitepress/theme/components/Archive.vue b/repos/.vitepress/theme/components/Archive.vue index ff2c15c6b..fc2cfa587 100644 --- a/repos/.vitepress/theme/components/Archive.vue +++ b/repos/.vitepress/theme/components/Archive.vue @@ -1,43 +1,23 @@ @@ -46,73 +26,32 @@ import { computed, ref } from 'vue' import { useData } from 'vitepress' import articleData from '../../../../article-data.json' import { formatDate } from '../utils.ts' -import '../styles/article-meta-data.css' +import { IconBug, IconBulb, IconCode, IconBookmark } from '@arco-design/web-vue/es/icon' const { theme } = useData() - -// 所有归档文章数据 -const archiveDataObj = computed(() => initArchiveData(articleData)) -console.log(archiveDataObj.value.yearList) - -/** - * 初始化归档数据 - * [{2020: [article1, article2, ...], ...}] - */ -function initArchiveData(articleData) { - const archiveData: any = {} - const yearList = [] - for (let i = 0; i < articleData.length; i++) { - const article = articleData[i] - const year = new Date(article.date).getFullYear() - - if (!archiveData[year]) { - archiveData[year] = [] - yearList.push(year) - } - - archiveData[year].push(article) - // 文章按发布时间降序排序 - archiveData[year].sort((a, b) => b.date.localeCompare(a.date)) - } - yearList.sort((a, b) => b - a) - return {'archiveData': archiveData, 'yearList': yearList} -} \ No newline at end of file diff --git a/repos/.vitepress/theme/components/Footer.vue b/repos/.vitepress/theme/components/Footer.vue index 60575afa6..d3dff63aa 100644 --- a/repos/.vitepress/theme/components/Footer.vue +++ b/repos/.vitepress/theme/components/Footer.vue @@ -38,6 +38,9 @@ const { theme } = useData() .VPFooter.has-sidebar { display: none; } +a:hover { + color: var(--vp-c-brand); +} @media (min-width: 768px) { .VPFooter { padding: 25px; diff --git a/repos/.vitepress/theme/components/Tag.vue b/repos/.vitepress/theme/components/Tag.vue index 633dc2bab..79d567e7f 100644 --- a/repos/.vitepress/theme/components/Tag.vue +++ b/repos/.vitepress/theme/components/Tag.vue @@ -133,10 +133,12 @@ function initTags(articleData) { --el-card-bg-color: var(--vp-c-bg); color: var(--vp-c-text-1); } - :deep(.el-tag) { background-color: var(--vp-c-bg); } +.vp-doc a:hover { + color: var(--vp-c-brand); +} /** 头部样式 */ .main-container-tag .tag-header-wrapper { diff --git a/repos/.vitepress/theme/index.ts b/repos/.vitepress/theme/index.ts index fc926bf78..83d673298 100644 --- a/repos/.vitepress/theme/index.ts +++ b/repos/.vitepress/theme/index.ts @@ -2,6 +2,8 @@ import DefaultTheme from 'vitepress/theme' import MyLayout from "./MyLayout.vue" import ElementPlus from 'element-plus' import "element-plus/dist/index.css" +import { Timeline } from '@arco-design/web-vue' +import '@arco-design/web-vue/es/timeline/style/css.js' import ArticleMetadata from './components/ArticleMetadata.vue' import Tag from './components/Tag.vue' import Archive from './components/Archive.vue' @@ -14,6 +16,8 @@ export default { enhanceApp({ app }) { // 全局注册ElementPlus app.use(ElementPlus) + // 全局注册ArcoDesign时间轴组件 + app.use(Timeline) app.component('ArticleMetadata', ArticleMetadata) app.component('Tag', Tag)