Skip to content

Commit

Permalink
fix(directives): ignore invalid directive hooks
Browse files Browse the repository at this point in the history
fix #795
  • Loading branch information
yyx990803 committed Mar 3, 2020
1 parent 27afbaf commit 7971b04
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/runtime-core/src/directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ export function withDirectives<T extends VNode>(
}
// 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
Expand Down

0 comments on commit 7971b04

Please sign in to comment.