count += n" />
```
Or, if the event handler is a method:
```vue-html
```
Then the value will be passed as the first parameter of that method:
```js
methods: {
increaseCount(n) {
this.count += n
}
}
```
```js
function increaseCount(n) {
count.value += n
}
```
:::tip
All extra arguments passed to `$emit()` after the event name will be forwarded to the listener. For example, with `$emit('foo', 1, 2, 3)` the listener function will receive three arguments.
:::
## Declaring Emitted Events {#declaring-emitted-events}
A component can explicitly declare the events it will emit using the [`defineEmits()`](/api/sfc-script-setup#defineprops-defineemits) macro[`emits`](/api/options-state#emits) option:
```vue
```
The `$emit` method that we used in the `` isn't accessible within the `
```
The `defineEmits()` macro **cannot** be used inside a function, it must be placed directly within `
```
If you are using TypeScript with `
```
More details: [Typing Component Emits](/guide/typescript/composition-api#typing-component-emits)
```js
export default {
emits: {
submit(payload: { email: string, password: string }) {
// return `true` or `false` to indicate
// validation pass / fail
}
}
}
```
See also: [Typing Component Emits](/guide/typescript/options-api#typing-component-emits)
Although optional, it is recommended to define all emitted events in order to better document how a component should work. It also allows Vue to exclude known listeners from [fallthrough attributes](/guide/components/attrs#v-on-listener-inheritance), avoiding edge cases caused by DOM events manually dispatched by 3rd party code.
:::tip
If a native event (e.g., `click`) is defined in the `emits` option, the listener will now only listen to component-emitted `click` events and no longer respond to native `click` events.
:::
## Events Validation {#events-validation}
Similar to prop type validation, an emitted event can be validated if it is defined with the object syntax instead of the array syntax.
To add validation, the event is assigned a function that receives the arguments passed to the `this.$emit``emit` call and returns a boolean to indicate whether the event is valid or not.
```vue
```
```js
export default {
emits: {
// No validation
click: null,
// Validate submit event
submit: ({ email, password }) => {
if (email && password) {
return true
} else {
console.warn('Invalid submit event payload!')
return false
}
}
},
methods: {
submitForm(email, password) {
this.$emit('submit', { email, password })
}
}
}
```