@@ -56,12 +56,12 @@ type acceptValueElm = HTMLInputElement | HTMLSelectElement | HTMLOptionElement;
5656function shouldUpdateValue ( elm : acceptValueElm , checkVal : string ) : boolean {
5757 return ( ! elm . composing && (
5858 elm . tagName === 'OPTION' ||
59- isDirty ( elm , checkVal ) ||
60- isInputChanged ( elm , checkVal )
59+ isNotInFocusAndDirty ( elm , checkVal ) ||
60+ isDirtyWithModifiers ( elm , checkVal )
6161 ) )
6262}
6363
64- function isDirty ( elm : acceptValueElm , checkVal : string ) : boolean {
64+ function isNotInFocusAndDirty ( elm : acceptValueElm , checkVal : string ) : boolean {
6565 // return true when textbox (.number and .trim) loses focus and its value is
6666 // not equal to the updated value
6767 let notInFocus = true
@@ -71,14 +71,20 @@ function isDirty (elm: acceptValueElm, checkVal: string): boolean {
7171 return notInFocus && elm . value !== checkVal
7272}
7373
74- function isInputChanged ( elm : any , newVal : string ) : boolean {
74+ function isDirtyWithModifiers ( elm : any , newVal : string ) : boolean {
7575 const value = elm . value
7676 const modifiers = elm . _vModifiers // injected by v-model runtime
77- if ( isDef ( modifiers ) && modifiers . number ) {
78- return toNumber ( value ) !== toNumber ( newVal )
79- }
80- if ( isDef ( modifiers ) && modifiers . trim ) {
81- return value . trim ( ) !== newVal . trim ( )
77+ if ( isDef ( modifiers ) ) {
78+ if ( modifiers . lazy ) {
79+ // inputs with lazy should only be updated when not in focus
80+ return false
81+ }
82+ if ( modifiers . number ) {
83+ return toNumber ( value ) !== toNumber ( newVal )
84+ }
85+ if ( modifiers . trim ) {
86+ return value . trim ( ) !== newVal . trim ( )
87+ }
8288 }
8389 return value !== newVal
8490}
0 commit comments