1.1.2 • Published 7 years ago

vue-shortcuts v1.1.2

Weekly downloads
58
License
MIT
Repository
github
Last release
7 years ago

VueShortcuts

npm vue2

A Simple keyboard shortcut plugin for Vue

Installation

npm install --save vue-shortcuts

Usage

Bundler (Webpack, Rollup)

import Vue from 'vue'
import VueShortcuts from 'vue-shortcuts'

Vue.use(VueShortcuts, { prevent: ['input'] })

Options

PropTypeDefaultDescribe
preventArray[]List of selectors that will ignore the event

Syntax

<component v-shortcuts="[
  { shortcut: [ 'ctrl', 'space' ], callback: foo, push: true, focus: true },
  { shortcut: [ 'shift', 'esc' ], callback: bar, once: true, disabled: someBoolean },
]">

<component2 v-shortcuts="[ { avoid: true } ]">

Props

PropTypeDefaultDescribe
shortcutArray[]Array of keystrokes that trigger the callback
callbackFunctionnoneCallback function called while the key is pressed
onceBooleanfalseTrigger only on keyup
pushBooleanfalseTrigger only on keydown and up, not contiuously while held
focusBooleanfalseFocus element instead of calling callback
disabledBooleanfalseReactive property that disables that key
avoidBooleanfalsePrevent the event when this element is focused
preventBooleantrueWhether to prevent the default and stop propagation when pressing that key

Key list

KeyShortkey Name
Shiftshift
Controlctrl
Altalt
Alt Graphaltgraph
Super (Windows or Mac Cmd)meta
Arrow Uparrowup
Arrow Downarrowdown
Arrow Leftarrowleft
Arrow Rightarrowright
Enterenter
Escapeesc
Tabtab
Spacespace
Page Uppageup
Page Downpagedown
Homehome
Endend
A - Za-z
0-90-9
F1-F12f1-f12

Credit

Initally forked from iFgR/vue-shortkey

License

MIT

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago