fix(runtime-core): fix kebab-case props update

fix #955
This commit is contained in:
Evan You
2020-04-13 12:37:31 -04:00
parent 27b5c71944
commit 7cbf684611
2 changed files with 23 additions and 9 deletions

View File

@@ -177,8 +177,15 @@ export function updateProps(
setFullProps(instance, rawProps, props, attrs)
// in case of dynamic props, check if we need to delete keys from
// the props object
let kebabKey: string
for (const key in rawCurrentProps) {
if (!rawProps || !hasOwn(rawProps, key)) {
if (
!rawProps ||
(!hasOwn(rawProps, key) &&
// it's possible the original props was passed in as kebab-case
// and converted to camelCase (#955)
((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))
) {
delete props[key]
}
}