Skip to content

Commit 3af6943

Browse files
committed
Translates 'guide/component-custom-events.md'
* Section 'Validate Emitted Events'
1 parent fcf520d commit 3af6943

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/guide/component-custom-events.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ No caso de um evento nativo (por exemplo, `click`) ser definido na opção `emit
3939
Recomenda-se definir todos os eventos emitidos para documentar melhor como um componente deve funcionar.
4040
:::
4141

42-
### Validate Emitted Events
42+
### Validar Eventos Emitidos
4343

44-
Similar to prop type validation, an emitted event can be validated if it is defined with the Object syntax instead of the Array syntax.
44+
Semelhante à validação de propriedades, um evento emitido pode ser validado se for definido com a sintaxe Object em vez da sintaxe Array.
4545

46-
To add validation, the event is assigned a function that receives the arguments passed to the `$emit` call and returns a boolean to indicate whether the event is valid or not.
46+
Para adicionar validação, o evento recebe uma função que recebe os argumentos passados ​​para a chamada `$emit` e retorna um booleano para indicar se o evento é válido ou não.
4747

4848
```js
4949
app.component('custom-form', {
5050
emits: {
51-
// No validation
51+
// Sem validação
5252
click: null,
5353

54-
// Validate submit event
54+
// Validar evento submit
5555
submit: ({ email, password }) => {
5656
if (email && password) {
5757
return true
@@ -69,15 +69,15 @@ app.component('custom-form', {
6969
})
7070
```
7171

72-
## `v-model` arguments
72+
## Argumentos `v-model`
7373

74-
By default, `v-model` on a component uses `modelValue` as the prop and `update:modelValue` as the event. We can modify these names passing an argument to `v-model`:
74+
Por padrão, `v-model` em um componente usa `modelValue` como propriedade e `update:modelValue` como evento. Podemos modificar esses nomes passando um argumento para `v-model`:
7575

7676
```html
7777
<my-component v-model:foo="bar"></my-component>
7878
```
7979

80-
In this case, child component will expect a `foo` prop and emits `update:foo` event to sync:
80+
Nesse caso, o componente filho espera a propriedade `foo` e emite o evento `update:foo` para sincronizar:
8181

8282
```js
8383
const app = Vue.createApp({})

0 commit comments

Comments
 (0)