diff --git a/src/pages/pc/word/DictDetail.vue b/src/pages/pc/word/DictDetail.vue index e0ce3254..79f31473 100644 --- a/src/pages/pc/word/DictDetail.vue +++ b/src/pages/pc/word/DictDetail.vue @@ -73,7 +73,7 @@ let studyLoading = $ref(false) function syncDictInMyStudyList(study = false) { _nextTick(() => { let rIndex = base.word.bookList.findIndex(v => v.id === runtimeStore.editDict.id) - let temp = cloneDeep(runtimeStore.editDict); + let temp = runtimeStore.editDict; if (!temp.custom && ![DictId.wordKnown, DictId.wordWrong, DictId.wordCollect].includes(temp.id)) { temp.custom = true temp.id += '_custom' @@ -265,6 +265,7 @@ function importData(e) { let data = null try { data = convertToWord({ + id : nanoid(6), word: v['单词'], phonetic0: v['音标①'] ?? '', phonetic1: v['音标②'] ?? '', diff --git a/src/types/func.ts b/src/types/func.ts index ce919878..fac3317f 100644 --- a/src/types/func.ts +++ b/src/types/func.ts @@ -6,6 +6,7 @@ import {nanoid} from "nanoid"; export function getDefaultWord(val: Partial = {}): Word { return { custom: false, + id : nanoid(6), "word": "", "phonetic0": "", "phonetic1": "", @@ -18,8 +19,7 @@ export function getDefaultWord(val: Partial = {}): Word { "rels": [] }, "etymology": [], - ...val, - id: val?.id ? val.id : nanoid(6), + ...val } }