Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fork/vue-mousetrap
Mousetrap directive for Vue
https://github.com/fork/vue-mousetrap
Last synced: 1 day ago
JSON representation
Mousetrap directive for Vue
- Host: GitHub
- URL: https://github.com/fork/vue-mousetrap
- Owner: fork
- License: mit
- Created: 2019-11-05T16:00:15.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-27T19:26:26.000Z (6 months ago)
- Last Synced: 2024-11-09T05:42:30.312Z (about 2 months ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 2
- Watchers: 8
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# `@4rk/vue-mousetrap`
A Vue plugin providing a directive to add global keyboard shortcuts to your components based on [Mousetrap](https://craig.is/killing/mice).
## Installation
```javascript
import VueMousetrap from "@4rk/vue-mousetrap";Vue.use(VueMousetrap);
```## Usage
```vue
hit ctrl-s to save
export default {
methods: {
onMousetrap() {
console.log("save!");
}
}
};```
## API
The `v-mousetrap` directive expects a Moustrap compatible value as defined at [Mousetrap.bind](https://craig.is/killing/mice#api.bind).
The `@mousetrap` event triggers with the Mousetrap event.