Merge pull request #4747 from betavs/hotfix/input-number-abnormal
fix(input-number): when zero is entered, value displayed isn't expectedpull/5098/head^2
commit
9a27f6b16b
|
@ -877,9 +877,16 @@ export default {
|
||||||
selectionEnd = sRegex.lastIndex + tRegex.lastIndex;
|
selectionEnd = sRegex.lastIndex + tRegex.lastIndex;
|
||||||
this.$refs.input.$el.setSelectionRange(selectionEnd, selectionEnd);
|
this.$refs.input.$el.setSelectionRange(selectionEnd, selectionEnd);
|
||||||
} else if (newLength === currentLength) {
|
} else if (newLength === currentLength) {
|
||||||
if (operation === 'insert' || operation === 'delete-back-single') this.$refs.input.$el.setSelectionRange(selectionEnd + 1, selectionEnd + 1);
|
if (operation === 'insert' || operation === 'delete-back-single') {
|
||||||
else if (operation === 'delete-single') this.$refs.input.$el.setSelectionRange(selectionEnd - 1, selectionEnd - 1);
|
const re = /[.,]/g;
|
||||||
else if (operation === 'delete-range' || operation === 'spin') this.$refs.input.$el.setSelectionRange(selectionEnd, selectionEnd);
|
const newSelectionEnd = selectionEnd + Number(re.test(value) || re.test(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') {
|
} else if (operation === 'delete-back-single') {
|
||||||
let prevChar = inputValue.charAt(selectionEnd - 1);
|
let prevChar = inputValue.charAt(selectionEnd - 1);
|
||||||
let nextChar = inputValue.charAt(selectionEnd);
|
let nextChar = inputValue.charAt(selectionEnd);
|
||||||
|
|
Loading…
Reference in New Issue