<div v-mydirect:fn="item"></div> Vue.directive('mydirect', { bind (el, binding,vnode) { let that = vnode.context that[binding.arg](binding.value) } })
methods:{
fn(item){
console.log(item)
}
}
<div v-mydirect:fn="item"></div> Vue.directive('mydirect', { bind (el, binding,vnode) { let that = vnode.context that[binding.arg](binding.value) } })
methods:{
fn(item){
console.log(item)
}
}