Skip to content
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

Add docs addressing "$attrs no longer contains events declared in the emits option" issue #3055

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
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
15 changes: 15 additions & 0 deletions src/api/options-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,21 @@ Declare the custom events emitted by the component.
}
```

Listeners on events may be captured in components by defining them as properties with the naming scheme of `on{Event}`:

> If an event contains a colon, use the naming scheme `on{Event}:{event}`.

```js
export default {
props: {
onCheck: Function,
'onClick:export': Function,
},

emits: ['check', 'click:export'],
}
```

- **See also**
- [Guide - Fallthrough Attributes](/guide/components/attrs)
- [Guide - Typing Component Emits](/guide/typescript/options-api#typing-component-emits) <sup class="vt-badge ts" />
Expand Down