Fixed #5545 - InputNumber Not Working android

pull/5656/head
tugcekucukoglu 2024-04-24 11:10:15 +03:00
parent 6004166df9
commit 1d9c036f31
1 changed files with 19 additions and 14 deletions

View File

@ -10,6 +10,7 @@
:aria-valuemin="min" :aria-valuemin="min"
:aria-valuemax="max" :aria-valuemax="max"
:aria-valuenow="modelValue" :aria-valuenow="modelValue"
:inputmode="mode === 'decimal' && !minFractionDigits ? 'numeric' : 'decimal'"
:disabled="disabled" :disabled="disabled"
:readonly="readonly" :readonly="readonly"
:placeholder="placeholder" :placeholder="placeholder"
@ -18,6 +19,7 @@
:aria-invalid="invalid || undefined" :aria-invalid="invalid || undefined"
@input="onUserInput" @input="onUserInput"
@keydown="onInputKeyDown" @keydown="onInputKeyDown"
@keypress="onInputKeyPress"
@paste="onPaste" @paste="onPaste"
@click="onInputClick" @click="onInputClick"
@focus="onInputFocus" @focus="onInputFocus"
@ -525,23 +527,26 @@ export default {
break; break;
default: default:
if (this.readonly) {
return;
}
event.preventDefault();
let char = event.key;
const isDecimalSign = this.isDecimalSign(char);
const isMinusSign = this.isMinusSign(char);
if ((Number(char) >= 0 && Number(char) <= 9) || isMinusSign || isDecimalSign) {
this.insert(event, char, { isDecimalSign, isMinusSign });
}
break; break;
} }
}, },
onInputKeyPress(event) {
if (this.readonly) {
return;
}
let char = event.key;
let isDecimalSign = this.isDecimalSign(char);
const isMinusSign = this.isMinusSign(char);
if (event.code !== 'Enter') {
event.preventDefault();
}
if ((Number(char) >= 0 && Number(char) <= 9) || isMinusSign || isDecimalSign) {
this.insert(event, char, { isDecimalSign, isMinusSign });
}
},
onPaste(event) { onPaste(event) {
event.preventDefault(); event.preventDefault();
let data = (event.clipboardData || window['clipboardData']).getData('Text'); let data = (event.clipboardData || window['clipboardData']).getData('Text');