/vue-attach-event

Project to be able to attach events through a directive to other events on HTML elements in VueJS

Primary LanguageJavaScriptMIT LicenseMIT

vue-attach-event

Directive to be able to attach events through other events on HTML elements in VueJS

Install

NPM:

npm i --save vue-attach-event

Require it in your main.js (or index.js) file:

// ES6
import 'vue-attach-event';

Usage instructions

Add v-attach-event as an attribute on the element you wish to handle a new event and pass and config object:

<button v-attach-event="config" @click="handler" @my-event="handler2">

Config

{
  on: 'eventName',
  newEvent: 'newEventName'
}
  • on (Required): Name of the original event that will trigger the new event.
  • newEvent (Required): Name of the new event to run with the original event.

License

MIT

TODO

  • Add event modifiers
  • Handler when config object changes