Skip to content

Commit f1d08ce

Browse files
KingMariochrisvfritz
authored andcommitted
Update modifier key modifiers description (vuejs#618)
* Update modifier key modifiers description Add keyboard event description. Add note for meta key. Add examples of keyboard and mouse events. * Update Key Modifiers title
1 parent 7185e08 commit f1d08ce

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/v2/guide/events.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,17 +224,29 @@ You can also [define custom key modifier aliases](../api/#keyCodes) via the glob
224224
Vue.config.keyCodes.f1 = 112
225225
```
226226

227-
## Mouse Event Modifiers
227+
## Modifier Keys
228228

229229
> New in 2.1.0
230230
231-
You can use the following modifiers to trigger mouse event listeners only when the corresponding key is pressed:
231+
You can use the following modifiers to trigger mouse or keyboard event listeners only when the corresponding modifier key is pressed:
232232

233233
- `.ctrl`
234234
- `.alt`
235235
- `.shift`
236236
- `.meta`
237237

238+
> Note: On Macintosh keyboards, meta is the command key (⌘). On Windows keyboards, meta is the windows key (⊞). On Sun Microsystems keyboards, meta is marked as a solid diamond (◆). On certain keyboards, specifically MIT and Lisp machine keyboards and successors, such as the Knight keyboard, space-cadet keyboard, meta is labeled “META”. On Symbolics keyboards, meta is labeled “META” or “Meta”.
239+
240+
For example:
241+
242+
```html
243+
<!-- Alt + C -->
244+
<input @keyup.alt.67="clear">
245+
246+
<!-- Ctrl + Click -->
247+
<div @click.ctrl="doSomething">Do something</div>
248+
```
249+
238250
## Why Listeners in HTML?
239251

240252
You might be concerned that this whole event listening approach violates the good old rules about "separation of concerns". Rest assured - since all Vue handler functions and expressions are strictly bound to the ViewModel that's handling the current view, it won't cause any maintenance difficulty. In fact, there are several benefits in using `v-on`:

0 commit comments

Comments
 (0)