fix(runtime-dom): should not coerce nullish values to empty strings for non-string dom props

fix #1049
close #1092, close #1093, close #1094
This commit is contained in:
Evan You
2020-05-01 11:06:24 -04:00
parent 68e1ce8b66
commit 20bc7ba1c5
2 changed files with 21 additions and 1 deletions

View File

@@ -31,7 +31,10 @@ export function patchDOMProp(
if (value === '' && typeof el[key] === 'boolean') {
// e.g. <select multiple> compiles to { multiple: '' }
el[key] = true
} else if (value == null && typeof el[key] === 'string') {
// e.g. <div :id="null">
el[key] = ''
} else {
el[key] = value == null ? '' : value
el[key] = value
}
}