Skip to content

Commit ec79709

Browse files
fix: fixed example for events casing
1 parent bb78180 commit ec79709

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/guide/component-custom-events.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,22 @@
44
55
## Event Names
66

7-
Unlike components and props, event names don't provide any automatic case transformation. Instead, the name of an emitted event must exactly match the name used to listen to that event. For example, if emitting a camelCased event name:
7+
Unlike components and props, event names don't provide any automatic case transformation. Instead, the name of an emitted event must exactly match the name used to listen to that event.
88

99
```js
1010
this.$emit('my-event')
1111
```
1212

13+
```html
14+
<my-component @my-event="doSomething"></my-component>
15+
```
16+
17+
If we're emitting a camelCased event name:
18+
19+
```js
20+
this.$emit('myEvent')
21+
```
22+
1323
Listening to the kebab-cased version will have no effect:
1424

1525
```html

0 commit comments

Comments
 (0)