From: Evan You Date: Tue, 3 Mar 2020 18:26:32 +0000 (-0600) Subject: fix(directives): ignore invalid directive hooks X-Git-Tag: v3.0.0-alpha.8~16 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7971b0468c81483dd7026204518f7c03187d13c4;p=thirdparty%2Fvuejs%2Fcore.git fix(directives): ignore invalid directive hooks fix #795 --- diff --git a/packages/runtime-core/src/directives.ts b/packages/runtime-core/src/directives.ts index eea35b64d3..6f733eadcd 100644 --- a/packages/runtime-core/src/directives.ts +++ b/packages/runtime-core/src/directives.ts @@ -126,8 +126,9 @@ export function withDirectives( } // inject onVnodeXXX hooks for (const key in dir) { - if (!injected[key]) { - const { 0: hookName, 1: hook } = directiveToVnodeHooksMap[key] + const mapped = directiveToVnodeHooksMap[key] + if (mapped && !injected[key]) { + const { 0: hookName, 1: hook } = mapped const existing = props[hookName] props[hookName] = existing ? [].concat(existing, hook as any) : hook injected[key] = true