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 GitHub
parent d227429fdc
commit 7042d1c06e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -307,7 +307,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) {