File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
packages/runtime-dom/src/directives Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -160,24 +160,26 @@ export const vModelCheckbox: ModelDirective<HTMLInputElement> = {
160
160
161
161
function setChecked (
162
162
el : HTMLInputElement ,
163
- { value } : DirectiveBinding ,
163
+ { value, oldValue } : DirectiveBinding ,
164
164
vnode : VNode ,
165
165
) {
166
166
// store the v-model value on the element so it can be accessed by the
167
167
// change listener.
168
168
; ( el as any ) . _modelValue = value
169
169
let checked : boolean
170
+ let isSimpleValue = false
170
171
171
172
if ( isArray ( value ) ) {
172
173
checked = looseIndexOf ( value , vnode . props ! . value ) > - 1
173
174
} else if ( isSet ( value ) ) {
174
175
checked = value . has ( vnode . props ! . value )
175
176
} else {
177
+ isSimpleValue = true
176
178
checked = looseEqual ( value , getCheckboxValue ( el , true ) )
177
179
}
178
180
179
181
// Only update if the checked state has changed
180
- if ( el . checked !== checked ) {
182
+ if ( el . checked !== checked && ( ! isSimpleValue || value !== oldValue ) ) {
181
183
el . checked = checked
182
184
}
183
185
}
You can’t perform that action at this time.
0 commit comments