You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add `.once` description modifier for v-on
Add `.once` description modifier for v-on and modifiers in render functions
* Update description of .once event modifier
* move event/key modifiers in render functions to that section
* improve styling for tables
Copy file name to clipboardExpand all lines: src/v2/guide/events.md
+10
Original file line number
Diff line number
Diff line change
@@ -164,6 +164,7 @@ To address this problem, Vue provides **event modifiers** for `v-on`. Recall tha
164
164
-`.prevent`
165
165
-`.capture`
166
166
-`.self`
167
+
-`.once`
167
168
168
169
```html
169
170
<!-- the click event's propagation will be stopped -->
@@ -186,6 +187,15 @@ To address this problem, Vue provides **event modifiers** for `v-on`. Recall tha
186
187
<divv-on:click.self="doThat">...</div>
187
188
```
188
189
190
+
> New in 2.1.4
191
+
192
+
```html
193
+
<!-- the click event will be triggered at most once -->
194
+
<av-on:click.once="doThis"></a>
195
+
```
196
+
197
+
Unlike the other modifiers, which are exclusive to native DOM events, the `.once` modifier can also be used on [component events](components.html#Using-v-on-with-Custom-Events). If you haven't read about components yet, don't worry about this for now.
198
+
189
199
## Key Modifiers
190
200
191
201
When listening for keyboard events, we often need to check for common key codes. Vue also allows adding key modifiers for `v-on` when listening for key events:
0 commit comments