fix(hydration): ensure hydrated event listeners have bound instance (#4529)

fix #4479
This commit is contained in:
ygj6
2021-09-22 00:39:21 +08:00
committed by GitHub
parent d8a36d0198
commit 58b1fa5ed1
2 changed files with 72 additions and 2 deletions

View File

@@ -287,13 +287,29 @@ export function createHydrationFunctions(
(forcePatchValue && key.endsWith('value')) ||
(isOn(key) && !isReservedProp(key))
) {
patchProp(el, key, null, props[key])
patchProp(
el,
key,
null,
props[key],
false,
undefined,
parentComponent
)
}
}
} else if (props.onClick) {
// Fast path for click listeners (which is most often) to avoid
// iterating through props.
patchProp(el, 'onClick', null, props.onClick)
patchProp(
el,
'onClick',
null,
props.onClick,
false,
undefined,
parentComponent
)
}
}
// vnode / directive hooks