8000 Update events.md by BarnabasSzabolcs · Pull Request #2941 · vuejs/v2.vuejs.org · GitHub
[go: up one dir, main page]

Skip to content

Update events.md #2941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update events.md
Added more explanation to modifiers that require a native event, otherwise generating surprising error messages.
  • Loading branch information
BarnabasSzabolcs authored Apr 11, 2022
commit a5e4052e98e753dc3f7042c5d180c6105c6c3245
6 changes: 6 additions & 0 deletions src/v2/guide/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ To address this problem, Vue provides **event modifiers** for `v-on`. Recall tha
- `.passive`

``` html
Please note that with the exception of `.once` the modifiers above only work with **native events**.

<p class="tip">
When emitting native-looking events from components, such as 'click', it is a good practice to also emit the native event. eg. `this.$emit('click', {...data, ...event})`. If you haven't read about components yet, don't worry about this for now.
</p>

<!-- the click event's propagation will be stopped -->
<a v-on:click.stop="doThis"></a>

Expand Down
0