Browse Source

adjust directive hook signature to expose all information

Evan You 10 years ago
parent
commit
d263bb237a

+ 1 - 1
src/core/vdom/modules/directives.js

@@ -35,7 +35,7 @@ function applyDirectives (
             continue
             continue
           }
           }
         }
         }
-        fn(vnode.elm, dir.value, dir.modifiers, vnode, oldVnode)
+        fn(vnode.elm, dir, vnode, oldVnode)
       }
       }
     }
     }
   }
   }

+ 2 - 2
src/platforms/web/runtime/directives/show.js

@@ -4,14 +4,14 @@ import { isIE9 } from 'web/util/index'
 import { enter, leave } from '../modules/transition'
 import { enter, leave } from '../modules/transition'
 
 
 export default {
 export default {
-  bind (el: HTMLElement, value: any, _: any, vnode: VNodeWithData) {
+  bind (el: HTMLElement, { value }: VNodeDirective, vnode: VNodeWithData) {
     const transition = getTransition(vnode)
     const transition = getTransition(vnode)
     if (value && transition && transition.appea && !isIE9) {
     if (value && transition && transition.appea && !isIE9) {
       enter(vnode)
       enter(vnode)
     }
     }
     el.style.display = value ? '' : 'none'
     el.style.display = value ? '' : 'none'
   },
   },
-  update (el: HTMLElement, value: any, _: any, vnode: VNodeWithData) {
+  update (el: HTMLElement, { value }: VNodeDirective, vnode: VNodeWithData) {
     const transition = getTransition(vnode)
     const transition = getTransition(vnode)
     if (transition && !isIE9) {
     if (transition && !isIE9) {
       if (value) {
       if (value) {