Skip to content

Commit ba6e4b8

Browse files
authored
Add docs about capturing event listeners in child components
1 parent 391b3ca commit ba6e4b8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/api/options-state.md

+15
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,21 @@ Declare the custom events emitted by the component.
433433
}
434434
```
435435

436+
Listeners on events may be captured in components by defining them as properties with the naming scheme of `on{Event}`:
437+
438+
> If an event contains a colon, use the naming scheme `on{Event}:{event}`.
439+
440+
```js
441+
export default {
442+
props: {
443+
onCheck: Function,
444+
'onClick:export': Function,
445+
},
446+
447+
emits: ['check', 'click:export'],
448+
}
449+
```
450+
436451
- **See also**
437452
- [Guide - Fallthrough Attributes](/guide/components/attrs)
438453
- [Guide - Typing Component Emits](/guide/typescript/options-api#typing-component-emits) <sup class="vt-badge ts" />

0 commit comments

Comments
 (0)