8000 Add once to modifiers of v-on (#678) · ywwhack/vuejs.org@1a57737 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1a57737

Browse files
38elementskazupon
authored andcommitted
Add once to modifiers of v-on (vuejs#678)
1 parent e05a8a4 commit 1a57737

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/v2/api/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,6 +1433,7 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
14331433
- `.self` - only trigger handler if event was dispatched from this element.
14341434
- `.{keyCode | keyAlias}` - only trigger handler on certain keys.
14351435
- `.native` - listen for a native event on the root element of component.
1436+
- `.once` - trigger handler at most once.
14361437

14371438
- **Usage:**
14381439

@@ -1471,6 +1472,9 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
14711472

14721473
<!-- key modifier using keyCode -->
14731474
<input @keyup.13="onEnter">
1475+
1476+
<!-- the click event will be triggered at most once -->
1477+
<button v-on:click.once="doThis"></button>
14741478
```
14751479

14761480
Listening to custom events on a child component (the handler is called when "my-event" is emitted on the child):

0 commit comments

Comments
 (0)
0