fix bug
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user