fix(Field): keep selection position after updating value (#11308)

This commit is contained in:
neverland 2022-11-26 20:17:51 +08:00 committed by chenjiahan
parent 41cf5706fd
commit 521748a5f8

View File

@ -303,7 +303,9 @@ export default defineComponent({
}
if (inputRef.value && inputRef.value.value !== value) {
const { selectionStart, selectionEnd } = inputRef.value;
inputRef.value.value = value;
inputRef.value.setSelectionRange(selectionStart, selectionEnd);
}
if (value !== props.modelValue) {