|
|
@ -146,13 +146,18 @@ const onInit = (keyboard: any) => { |
|
|
|
document.addEventListener('click', handlePopClose) |
|
|
|
} |
|
|
|
const onChange = (input: any) => { |
|
|
|
ignoreBlur.value = true |
|
|
|
console.log(input) |
|
|
|
model.value = input |
|
|
|
setTimeout(() => { |
|
|
|
ignoreBlur.value = false |
|
|
|
}, 150) |
|
|
|
|
|
|
|
emits('onChange', input) |
|
|
|
} |
|
|
|
|
|
|
|
const onKeyPress = (button: any) => { |
|
|
|
ignoreBlur.value = true |
|
|
|
if (button === '{lock}') |
|
|
|
return handleLock() |
|
|
|
if (button === '{change}') |
|
|
@ -195,6 +200,9 @@ const handleLock = () => { |
|
|
|
keyboard.value.setOptions({ |
|
|
|
layoutName: shiftToggle, |
|
|
|
}) |
|
|
|
setTimeout(() => { |
|
|
|
ignoreBlur.value = false |
|
|
|
}, 150) |
|
|
|
} |
|
|
|
const handleChange = () => { |
|
|
|
entering.value = true |
|
|
@ -216,12 +224,18 @@ const handleChange = () => { |
|
|
|
display: displayDefault.value, |
|
|
|
}) |
|
|
|
} |
|
|
|
setTimeout(() => { |
|
|
|
ignoreBlur.value = false |
|
|
|
}, 150) |
|
|
|
} |
|
|
|
const handleClear = () => { |
|
|
|
keyboard.value.clearInput() |
|
|
|
model.value = '' |
|
|
|
} |
|
|
|
const handleEnter = () => { |
|
|
|
setTimeout(() => { |
|
|
|
ignoreBlur.value = false |
|
|
|
}, 150) |
|
|
|
emits('enter') |
|
|
|
} |
|
|
|
const handleClose = () => { |
|
|
@ -230,6 +244,9 @@ const handleClose = () => { |
|
|
|
// model.value = model.value?.replace(new RegExp(`(\\d+)\\.(\\d{${props.precision}}).*$`), '$1.$2').replace(/\.$/, '') |
|
|
|
} |
|
|
|
popoverRef.value.hide() |
|
|
|
setTimeout(() => { |
|
|
|
ignoreBlur.value = false |
|
|
|
}, 150) |
|
|
|
emits('close') |
|
|
|
} |
|
|
|
const handleArrow = (num: number) => { |
|
|
@ -241,6 +258,9 @@ const handleArrow = (num: number) => { |
|
|
|
else if (num === 1 && index + 1 <= (model.value?.length || 0)) { |
|
|
|
keyboard.value.setCaretPosition(index + 1) |
|
|
|
} |
|
|
|
setTimeout(() => { |
|
|
|
ignoreBlur.value = false |
|
|
|
}, 150) |
|
|
|
} |
|
|
|
|
|
|
|
const handlePopClose = (e: any) => { |
|
|
|