diff --git a/components.d.ts b/components.d.ts index fc80ea7a..70b389c6 100644 --- a/components.d.ts +++ b/components.d.ts @@ -9,6 +9,7 @@ declare module 'vue' { export interface GlobalComponents { Add: typeof import('./src/components/Toolbar/Add.vue')['default'] AddDict: typeof import('./src/components/Add/AddDict.vue')['default'] + AddWordDialog: typeof import('./src/components/Modal/AddWordDialog.vue')['default'] ArticleList: typeof import('./src/components/Article/ArticleList.vue')['default'] Backgorund: typeof import('./src/components/Backgorund.vue')['default'] BaseButton: typeof import('./src/components/BaseButton.vue')['default'] @@ -22,6 +23,7 @@ declare module 'vue' { DictGroup: typeof import('./src/components/Toolbar/DictGroup.vue')['default'] DictItem: typeof import('./src/components/list/DictItem.vue')['default'] DictList: typeof import('./src/components/list/DictList.vue')['default'] + DictModal: typeof import('./src/components/Modal/DictModal.vue')['default'] DictModal2: typeof import('./src/components/Modal/DictModal2.vue')['default'] EditAbleText: typeof import('./src/components/EditAbleText.vue')['default'] EditArticle: typeof import('./src/components/Article/EditArticle.vue')['default'] diff --git a/src/components/Empty.vue b/src/components/Empty.vue index ecd2ada0..3572d439 100644 --- a/src/components/Empty.vue +++ b/src/components/Empty.vue @@ -1,13 +1,21 @@ @@ -23,6 +31,7 @@ defineProps<{ gap: 20rem; img { + margin-top: -50rem; width: 120rem; } } diff --git a/src/components/Modal/DictDialog/index.vue b/src/components/Modal/DictDialog/index.vue index f2eaf602..d2a14024 100644 --- a/src/components/Modal/DictDialog/index.vue +++ b/src/components/Modal/DictDialog/index.vue @@ -350,7 +350,12 @@ async function onSubmitWord() { //因为虚拟列表,必须重新赋值才能检测到更新 wordList = cloneDeep(runtimeStore.editDict.words) - runtimeStore.editDict.chapterWords[runtimeStore.editDict.chapterWords.length - 1].push(data) + if (runtimeStore.editDict.chapterWords.length) { + runtimeStore.editDict.chapterWords[runtimeStore.editDict.chapterWords.length - 1].push(data) + } else { + runtimeStore.editDict.chapterWords.push([data]) + runtimeStore.editDict.chapterIndex = 0 + } ElMessage.success('添加成功') wordForm = cloneDeep(DefaultFormWord) @@ -358,22 +363,24 @@ async function onSubmitWord() { } console.log('runtimeStore.editDict', runtimeStore.editDict) } else { + let oldData = cloneDeep(runtimeStore.editDict.words[wordFormMode]) runtimeStore.editDict.words[wordFormMode] = data //因为虚拟列表,必须重新赋值才能检测到更新 wordList = cloneDeep(runtimeStore.editDict.words) //同步到原始列表,因为word可能是随机的,所以需要自己寻找index去修改原始列表 - let rIndex = runtimeStore.editDict.originWords.findIndex(v => v.name === data.name) + let rIndex = runtimeStore.editDict.originWords.findIndex(v => v.name === oldData.name) if (rIndex > -1) { runtimeStore.editDict.originWords[rIndex] = data } runtimeStore.editDict.chapterWords = runtimeStore.editDict.chapterWords.map(list => { - let rIndex2 = list.findIndex(v => v.name === data.name) + let rIndex2 = list.findIndex(v => v.name === oldData.name) if (rIndex2 > -1) { list[rIndex2] = data } return list }) + console.log('runtimeStore.editDict.chapterWords', runtimeStore.editDict.chapterWords) ElMessage.success('修改成功') } syncMyDictList() @@ -652,12 +659,18 @@ watch(() => step, v => { 单词列表 - + > + + + +
step, v => { icon="solar:trash-bin-minimalistic-linear"/> - +