fix(runtime-dom): avoid setting unchanged input value (#1937)
fix #1935 (fix v-model usage with HTML5 validation)
This commit is contained in:
parent
67b6e0f894
commit
1d55454e61
@ -85,7 +85,10 @@ export const vModelText: ModelDirective<
|
||||
return
|
||||
}
|
||||
}
|
||||
el.value = value == null ? '' : value
|
||||
const newValue = value == null ? '' : value
|
||||
if (el.value !== newValue) {
|
||||
el.value = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,10 @@ export function patchDOMProp(
|
||||
// store value as _value as well since
|
||||
// non-string values will be stringified.
|
||||
el._value = value
|
||||
el.value = value == null ? '' : value
|
||||
const newValue = value == null ? '' : value
|
||||
if (el.value !== newValue) {
|
||||
el.value = newValue
|
||||
}
|
||||
return
|
||||
}
|
||||
if (value === '' && typeof el[key] === 'boolean') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user