@@ -90,14 +90,19 @@ export default (
90
90
lazyBoolean . value === true ? NaN : debounceMaxWaitNumber . value
91
91
)
92
92
93
- const updateModelValue = useDebounceFn (
93
+ const internalUpdateModelValue = useDebounceFn (
94
94
( value : string | number | undefined ) => {
95
95
modelValue . value = value
96
96
} ,
97
97
computedDebounceValueWithLazy ,
98
98
{ maxWait : computedDebounceMaxWaitValueWithLazy }
99
99
)
100
100
101
+ const updateModelValue = ( value : string | number | undefined , force = false ) => {
102
+ if ( lazyBoolean . value === true && force === false ) return
103
+ internalUpdateModelValue ( value )
104
+ }
105
+
101
106
const { focused} = useFocus ( input , {
102
107
initialValue : autofocusBoolean . value ,
103
108
} )
@@ -118,12 +123,6 @@ export default (
118
123
return value
119
124
}
120
125
121
- const handleAutofocus = ( ) => {
122
- if ( autofocusBoolean . value ) {
123
- focused . value = true
124
- }
125
- }
126
-
127
126
onMounted ( ( ) => {
128
127
if ( input . value ) {
129
128
input . value . value = modelValue . value as string
@@ -132,7 +131,9 @@ export default (
132
131
133
132
onActivated ( ( ) => {
134
133
nextTick ( ( ) => {
135
- handleAutofocus ( )
134
+ if ( autofocusBoolean . value ) {
135
+ focused . value = true
136
+ }
136
137
} )
137
138
} )
138
139
@@ -148,14 +149,10 @@ export default (
148
149
return
149
150
}
150
151
151
- if ( lazyBoolean . value ) return
152
-
153
152
const nextModel = _getModelValue ( formattedValue )
154
153
155
- if ( modelValue . value !== nextModel ) {
156
- inputValue = value
157
- updateModelValue ( nextModel )
158
- }
154
+ inputValue = value
155
+ updateModelValue ( nextModel )
159
156
160
157
emit ( 'input' , formattedValue )
161
158
}
@@ -168,14 +165,10 @@ export default (
168
165
return
169
166
}
170
167
171
- if ( ! lazyBoolean . value ) return
172
168
inputValue = value
173
- updateModelValue ( formattedValue )
169
+ updateModelValue ( formattedValue , true )
174
170
175
- const nextModel = _getModelValue ( formattedValue )
176
- if ( modelValue . value !== nextModel ) {
177
- emit ( 'change' , formattedValue )
178
- }
171
+ emit ( 'change' , formattedValue )
179
172
}
180
173
181
174
const onBlur = ( evt : FocusEvent ) => {
@@ -186,7 +179,7 @@ export default (
186
179
const formattedValue = _formatValue ( value , evt , true )
187
180
188
181
inputValue = value
189
- updateModelValue ( formattedValue )
182
+ updateModelValue ( formattedValue , true )
190
183
}
191
184
192
185
const focus = ( ) => {
@@ -197,7 +190,7 @@ export default (
197
190
198
191
const blur = ( ) => {
199
192
if ( ! disabledBoolean . value ) {
200
- input . value ?. blur ( )
193
+ focused . value = false
201
194
}
202
195
}
203
196
0 commit comments