Browse Source

fix(runtime-dom): avoid always resetting nullish option value

close #10396
pull/10404/head
Evan You 1 year ago
parent
commit
ff130c4702
  1. 3
      packages/runtime-dom/src/modules/props.ts

3
packages/runtime-dom/src/modules/props.ts

@ -39,7 +39,8 @@ export function patchDOMProp(
el._value = value
// #4956: <option> value will fallback to its text content so we need to
// compare against its attribute value instead.
const oldValue = tag === 'OPTION' ? el.getAttribute('value') : el.value
const oldValue =
tag === 'OPTION' ? el.getAttribute('value') || '' : el.value
const newValue = value == null ? '' : value
if (oldValue !== newValue) {
el.value = newValue

Loading…
Cancel
Save