From d70d52942661470c5f63546c7f6f1488fc157dc9 Mon Sep 17 00:00:00 2001 From: Zyronon Date: Fri, 2 Jan 2026 01:02:26 +0800 Subject: [PATCH] wip --- src/assets/css/style.scss | 1 - src/components/list/ArticleList.vue | 5 +- src/pages/article/BookDetail.vue | 116 +++++++++++++++++----------- 3 files changed, 74 insertions(+), 48 deletions(-) diff --git a/src/assets/css/style.scss b/src/assets/css/style.scss index bc5f2d6f..2f6f7555 100644 --- a/src/assets/css/style.scss +++ b/src/assets/css/style.scss @@ -292,7 +292,6 @@ a { &:hover { @extend .active; - background: var(--color-fourth); svg { opacity: 1; diff --git a/src/components/list/ArticleList.vue b/src/components/list/ArticleList.vue index d2b9778e..8917bcaa 100644 --- a/src/components/list/ArticleList.vue +++ b/src/components/list/ArticleList.vue @@ -8,16 +8,17 @@ import BaseIcon from '@/components/BaseIcon.vue' interface IProps { list: Article[] showTranslate?: boolean + showDesc?: boolean } const props = withDefaults(defineProps(), { list: () => [] as Article[], showTranslate: true, + showDesc: false, }) const emit = defineEmits<{ click: [val: { item: Article; index: number }] - title: [val: { item: Article; index: number }] }>() let searchKey = $ref('') @@ -88,7 +89,7 @@ defineExpose({ scrollToBottom, scrollToItem })
- {{ index }}. + {{ item.id == -1 ? '' : (index - (props.showDesc ? 1 : 0)) + '.' }} {{ item.title }}
diff --git a/src/pages/article/BookDetail.vue b/src/pages/article/BookDetail.vue index ad766347..6ef95100 100644 --- a/src/pages/article/BookDetail.vue +++ b/src/pages/article/BookDetail.vue @@ -32,7 +32,7 @@ let isAdd = $ref(false) let loading = $ref(false) let studyLoading = $ref(false) -let selectArticle: Article = $ref(getDefaultArticle()) +let selectArticle: Article = $ref(getDefaultArticle({ id: -1 })) // 计算当前选中文章的索引 const currentArticleIndex = computed(() => { @@ -101,9 +101,6 @@ async function init() { } } } - if (runtimeStore.editDict.articles.length) { - selectArticle = runtimeStore.editDict.articles[0] - } loading = false } } @@ -168,11 +165,20 @@ function next() { selectArticle = runtimeStore.editDict.articles[index + 1] } } + +const list = $computed(() => { + return [ + getDefaultArticle({ + title: '介绍', + id: -1, + }), + ].concat(runtimeStore.editDict.articles) +}) +```````` ;