Browse Source

fix(runtime-dom): cast to true for boolean props

Evan You 6 years ago
parent
commit
59e18e5478
1 changed files with 6 additions and 1 deletions
  1. 6 1
      packages/runtime-dom/src/modules/props.ts

+ 6 - 1
packages/runtime-dom/src/modules/props.ts

@@ -18,5 +18,10 @@ export function patchDOMProp(
     // non-string values will be stringified.
     // non-string values will be stringified.
     el._value = value
     el._value = value
   }
   }
-  el[key] = value == null ? '' : value
+  if (value === '' && typeof el[key] === 'boolean') {
+    // e.g. <select multiple> compiles to { multiple: '' }
+    el[key] = true
+  } else {
+    el[key] = value == null ? '' : value
+  }
 }
 }