Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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.