<template>
<my-input v-my-directive="xxx"></my-input>
</template>
inside MyInput file:
<template>
<div class="my-input" @someEvent="trigger">
<input type="text"/>
</div>
</template>
<script>
export default {
name: 'MyInput',
methods: {
trigger(){
this.$emit('someEvent')
}
}
}
</script>
inside MyDirective file
export default Vue.directive('my-directive', {
bind(el, binding, vnode) {
// listen to someEvent here
}
})
I want this v-my-directive
listen my-input
's event. But I can't find any way to achieve this.