From c1991df954eaa6e969a7db597743d808ce3ec380 Mon Sep 17 00:00:00 2001 From: zyronon Date: Tue, 21 Nov 2023 18:59:39 +0800 Subject: [PATCH] save --- src/components/dialog/DictDiglog.vue | 13 ++++++- src/components/list/ChapterList.vue | 56 ++++++++++++++++++---------- 2 files changed, 49 insertions(+), 20 deletions(-) diff --git a/src/components/dialog/DictDiglog.vue b/src/components/dialog/DictDiglog.vue index eba0a241..6d4495f0 100644 --- a/src/components/dialog/DictDiglog.vue +++ b/src/components/dialog/DictDiglog.vue @@ -398,7 +398,7 @@ function delWord(word: Word, index: number) { } } - runtimeStore.editDict.words.splice(DictDiglog, 1) + runtimeStore.editDict.words.splice(index, 1) wordList = cloneDeep(runtimeStore.editDict.words) syncMyDictList() @@ -437,6 +437,16 @@ function add() { /* 单词修改相关*/ /**/ + +/**/ +/* 文章修改相关*/ +/**/ + +function delChapter(index: number) { + runtimeStore.editDict.articles.splice(index, 1) + syncMyDictList() +} + watch(() => step, v => { if (v === 0) { closeWordForm() @@ -717,6 +727,7 @@ onMounted(() => { v-if="chapterList" v-loading="loading" :is-article="dictIsArticle" + @del="delChapter" v-model:active-index="runtimeStore.editDict.chapterIndex" :dict="runtimeStore.editDict"/> diff --git a/src/components/list/ChapterList.vue b/src/components/list/ChapterList.vue index c7661bef..c0a936b3 100644 --- a/src/components/list/ChapterList.vue +++ b/src/components/list/ChapterList.vue @@ -4,6 +4,7 @@ import {Dict, Word} from "@/types.ts" import {emitter, EventKey} from "@/utils/eventBus.ts"; import {$computed} from "vue/macros"; import {useRuntimeStore} from "@/stores/runtime.ts"; +import BaseIcon from "@/components/BaseIcon.vue"; const props = defineProps<{ dict: Dict, @@ -13,6 +14,7 @@ const props = defineProps<{ const emit = defineEmits<{ 'update:activeIndex': [index: number] + del: [index: number] }>() const runtimeStore = useRuntimeStore() @@ -40,21 +42,28 @@ function showWordListModal(index: number, item: Word[]) { @click="emit('update:activeIndex', index)">
- + +
+ +
+
@@ -76,21 +85,30 @@ function showWordListModal(index: number, item: Word[]) { .common-list-item { - &:hover { - .title { - border-bottom: 2px solid gray !important; - } - } - input { cursor: pointer; } - .title { + .item-title { transition: all .3s; cursor: pointer; border-bottom: 2px solid transparent; } + + :deep(.del) { + opacity: 0; + } + + &:hover { + .item-title { + border-bottom: 2px solid gray !important; + } + + :deep(.del) { + opacity: 1; + } + } + } } \ No newline at end of file