fix(runtime-dom): avoid setting unchanged input value (#1937)

fix #1935 (fix v-model usage with HTML5 validation)
This commit is contained in:
ᴜɴвʏтᴇ
2020-08-25 21:47:55 +08:00
committed by GitHub
parent 67b6e0f894
commit 1d55454e61
2 changed files with 8 additions and 2 deletions

View File

@@ -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') {