mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-08 16:37:15 +00:00
fix(input-number): when zero is entered, value displayed isn't expected
This commit is contained in:
parent
4223a8f895
commit
60b3806dab
1 changed files with 9 additions and 3 deletions
|
@ -869,9 +869,15 @@ export default {
|
|||
selectionEnd = sRegex.lastIndex + tRegex.lastIndex;
|
||||
this.$refs.input.$el.setSelectionRange(selectionEnd, selectionEnd);
|
||||
} else if (newLength === currentLength) {
|
||||
if (operation === 'insert' || operation === 'delete-back-single') this.$refs.input.$el.setSelectionRange(selectionEnd + 1, selectionEnd + 1);
|
||||
else if (operation === 'delete-single') this.$refs.input.$el.setSelectionRange(selectionEnd - 1, selectionEnd - 1);
|
||||
else if (operation === 'delete-range' || operation === 'spin') this.$refs.input.$el.setSelectionRange(selectionEnd, selectionEnd);
|
||||
if (operation === 'insert' || operation === 'delete-back-single') {
|
||||
const newSelectionEnd = selectionEnd + Number(this.isDecimalSign(value) || this.isDecimalSign(insertedValueStr));
|
||||
|
||||
this.$refs.input.$el.setSelectionRange(newSelectionEnd, newSelectionEnd);
|
||||
} else if (operation === 'delete-single') {
|
||||
this.$refs.input.$el.setSelectionRange(selectionEnd - 1, selectionEnd - 1);
|
||||
} else if (operation === 'delete-range' || operation === 'spin') {
|
||||
this.$refs.input.$el.setSelectionRange(selectionEnd, selectionEnd);
|
||||
}
|
||||
} else if (operation === 'delete-back-single') {
|
||||
let prevChar = inputValue.charAt(selectionEnd - 1);
|
||||
let nextChar = inputValue.charAt(selectionEnd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue