🏃 Vue.js directive to add a document event listener on escape keyup.
- Vue.js 2 =>
vue-esc@>=2.0.0
[master] - Vue.js 1 =>
[email protected]
$ npm i -S vue-esc
$ yarn add vue-esc
// main.js
import Vue from 'vue';
import VueEsc from 'vue-esc';
Vue.use(VueEsc);
<script>
// Component.vue
export default {
name: 'Component',
methods: {
escape(event) {
console.log('Esc key pressed.', `Event: ${event}`);
}
}
};
</script>
<template>
<div v-esc="escape"></div>
</template>
# install dependencies
$ npm install
# dev mode
$ npm run dev
# test
$ npm run test
# build
$ npm run build
This project was built with yeoman and generator-vue-component ❤️