Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 868c68d

Browse files
author
Evan You
committed
events doc change
1 parent bbcc813 commit 868c68d

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

‎source/guide/events.md‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ new Vue({
2727
})
2828
```
2929

30-
One thing to note is that internally, Vue.js uses event delegation for all `v-on` handlers. Vue.js ensures that `event.stopPropagation()` and `event.preventDefault()` will work like normal listeners, but `event.currentTarget` will always point to the ViewModel's root element. In cases where `event.target` is a childNode of the actual element that the `v-on` directive is bound to, the element with `v-on` will be available as `event.delegationTarget`.
31-
3230
## Invoke Handler with Expression
3331

3432
`targetVM` could be useful when `v-on` is used with `v-repeat`, since the latter creates a lot of child ViewModels. However, it is often more convenient to use an invocation expression passing in `this`, which equals the current context ViewModel:
@@ -98,7 +96,6 @@ You might be concerned about this whole event listening approach violates the go
9896

9997
1. It makes it easier to locate the handler function implementations within your JS code by simply skimming the HTML template.
10098
2. Since you don't have to manually attach event listeners in JS, your ViewModel code can be pure logic and DOM-free. This makes it easier to test.
101-
3. When a ViewModel is destroyed, all event listeners are automatically removed.
102-
4. Vue.js automatically uses event delegation on each VM's root element instead of attaching a listner on every Node. Listeners on `v-repeat` instances are delegated together on their parent ViewModel.
99+
3. When a ViewModel is destroyed, all event listeners are automatically removed. You don't need to worry about cleaning it up yourself.
103100

104101
Next up: [Handling Forms](/guide/forms.html).

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /