0.1.2 • Published 7 years ago
vue-shortcut v0.1.2
vue-shortcut
A declarative Vue wrapper for jkup's shortcut library. This component exposes methods that, when used, bind event listeners to common keyboard shortcuts.
Shortcuts
| Shortcut | Event Name |
|---|---|
| j | nextItem |
| k | prevItem |
| n | newItem |
| o | openItem |
| / | searchItems |
| . | loadItems |
| ? | showHelp |
Installation
Install the package from npm by running
$ npm install --save vue-shortcutor
$ yarn add vue-shortcutUsage
Import, register and place the component in your Vue app. Attach a function to react to any of the events listed above for example 'v-on:nextItem="doSomething"' or '@nextItem="doSomething"'.
<template>
<VueShortcut @nextItem="goForward" @prevItem="goBack" />
</template>
<script>
import VueShortcut from 'vue-shortcut';
export default {
components: {
VueShortcut
}
}
</script>Dev
Running dev and example scripts require @vue/cli and @vue/cli-service-global to be installed. Install globally by running
$ npm install --save --g @vue/cli @vue/cli-service-globalor
$ yarn add global vue/cli @vue/cli-service-globalContributing
This project is open to and encourages contributions! Feel free to discuss any bug fixes/features in the issues. If you wish to work on this project:
- Fork the project
- Create your feature branch (
git checkout -b new-feature-branch) - Commit your changes (
git commit -am 'add new feature') - Push to the branch (
git push origin new-feature-branch) - Submit a pull request!