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
{{ message }}
This repository was archived by the owner on Dec 1, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,8 +66,7 @@ new Vue({
66
66
});
67
67
```
68
68
69
-
### Short example
70
-
Lets see how **easy** you can **watch global events** like reactive properties! (Like in this [example](https://vuejs.org/v2/examples/commits.html)).
69
+
Lets see how **easy** you can **watch global events** like reactive properties! (Like in this [example](https://vuejs.org/v2/examples/commits.html)).
71
70
Let's assume you have a logout button in any component template and want it to be handled *somewhere else* without these nasty `$on(...)` and `$off(...)` lines in the created and destroy hooks.
72
71
73
72
```html
@@ -78,17 +77,21 @@ Let's assume you have a logout button in any component template and want it to b
78
77
```js
79
78
// userManager.vue
80
79
exportdefault {
80
+
81
81
name:'any-other-component',
82
+
82
83
events: {
83
84
// the event name string binds the method name string
84
85
'logout:the-user':'logout'
85
86
},
87
+
86
88
methods: {
87
89
// this method will be called everytime the event occurs
0 commit comments