This commit is contained in:
zyronon
2023-11-03 18:52:42 +08:00
parent c8413334e5
commit 0933013755
12 changed files with 138 additions and 124 deletions

View File

@@ -46,11 +46,19 @@ export function useWordOptions() {
}
}
function delSimpleWord(val: Word) {
let rIndex = store.simple.originWords.findIndex(v => v.name.toLowerCase() === val.name.toLowerCase())
if (rIndex > -1) {
store.simple.originWords.splice(rIndex, 1)
}
}
return {
isWordCollect,
toggleWordCollect,
isWordSimple,
toggleWordSimple,
delWrongWord
delWrongWord,
delSimpleWord
}
}

View File

@@ -41,7 +41,7 @@ export function useStartKeyboardEventListener() {
|| e.keyCode === 229
) {
emitter.emit(EventKey.onTyping, e)
}else {
} else {
emitter.emit(EventKey.keydown, e)
}
}
@@ -84,35 +84,3 @@ export function useDisableEventListener(watchVal?: any) {
}
})
}
export function useEsc(close: () => void, watchVal?: any) {
const runtimeStore = useRuntimeStore()
const id = $ref(Date.now())
watch(watchVal, n => {
if (n) {
runtimeStore.modalList.push({id, close})
} else {
let rIndex = runtimeStore.modalList.findIndex(item => item.id === id)
if (rIndex > 0) {
runtimeStore.modalList.splice(rIndex, 1)
}
}
})
onMounted(() => {
if (watchVal() === undefined) {
runtimeStore.modalList.push({id, close})
}
})
onUnmounted(() => {
if (watchVal() === undefined) {
let rIndex = runtimeStore.modalList.findIndex(item => item.id === id)
if (rIndex > 0) {
runtimeStore.modalList.splice(rIndex, 1)
}
}
})
}