Develop dictionary management function

This commit is contained in:
zyronon
2023-11-28 18:32:37 +08:00
parent 3e6bbfd282
commit a0568b7eaa
3 changed files with 18 additions and 7 deletions

View File

@@ -3,6 +3,7 @@ import {useBaseStore} from "@/stores/base.ts";
import {useRuntimeStore} from "@/stores/runtime.ts";
import {chunk, cloneDeep} from "lodash-es";
import {v4 as uuidv4} from "uuid";
import {isArticle} from "@/hooks/article.ts";
export function useWordOptions() {
@@ -144,7 +145,11 @@ export function syncMyDictList(dict: Dict) {
const store = useBaseStore()
//任意修改,都将其变为自定义词典
dict.isCustom = true
dict.length = dict.words.length + dict.residueWords.length
if (isArticle(dict.type)) {
dict.length = dict.articles.length
} else {
dict.length = dict.words.length + dict.residueWords.length
}
let rIndex = store.myDictList.findIndex(v => v.id === dict.id)
if (rIndex > -1) {