Develop dictionary management function

This commit is contained in:
zyronon
2023-11-28 18:23:11 +08:00
parent 52b12771a2
commit 3e6bbfd282
8 changed files with 916 additions and 543 deletions

View File

@@ -137,4 +137,19 @@ export async function checkDictHasTranslate(dict: Dict) {
}
}
}
//同步到我的词典列表
export function syncMyDictList(dict: Dict) {
const store = useBaseStore()
//任意修改,都将其变为自定义词典
dict.isCustom = true
dict.length = dict.words.length + dict.residueWords.length
let rIndex = store.myDictList.findIndex(v => v.id === dict.id)
if (rIndex > -1) {
store.myDictList[rIndex] = cloneDeep(dict)
} else {
store.myDictList.push(cloneDeep(dict))
}
}