Skip to content

Commit fe7376f

Browse files
authored
Merge pull request #217 from LucasCastro99/patch-2
Tradução de "api/special-attributes.md"
2 parents 55127a1 + 952acd3 commit fe7376f

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

src/api/special-attributes.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,70 @@
1-
# Special Attributes
1+
# Atributos Especiais
22

33
## key
44

5-
- **Expects:** `number | string`
5+
- **Esperado:** `number | string`
66

7-
The `key` special attribute is primarily used as a hint for Vue's virtual DOM algorithm to identify VNodes when diffing the new list of nodes against the old list. Without keys, Vue uses an algorithm that minimizes element movement and tries to patch/reuse elements of the same type in-place as much as possible. With keys, it will reorder elements based on the order change of keys, and elements with keys that are no longer present will always be removed/destroyed.
7+
O atributo especial `key` é usado principalmente como uma dica para o algoritmo DOM virtual do Vue para identificar VNodes ao comparar a nova lista de nós com a lista antiga. Sem as chaves, o Vue usa um algoritmo que minimiza o movimento do elemento e tenta corrigir/reutilizar elementos do mesmo tipo no local, tanto quanto possível. Com as chaves, ele reordenará os elementos com base na alteração da ordem das chaves, e os elementos com chaves que não estão mais presentes sempre serão removidos/destruídos.
88

9-
Children of the same common parent must have **unique keys**. Duplicate keys will cause render errors.
9+
Filhos do mesmo pai comum devem ter **chaves únicas**. Chaves duplicadas causarão erros de renderização.
1010

11-
The most common use case is combined with `v-for`:
11+
O caso de uso mais comum é combinado com `v-for`:
1212

1313
```html
1414
<ul>
1515
<li v-for="item in items" :key="item.id">...</li>
1616
</ul>
1717
```
1818

19-
It can also be used to force replacement of an element/component instead of reusing it. This can be useful when you want to:
19+
Também pode ser usado para forçar a substituição de um elemento/componente em vez de reutilizá-lo. Isso pode ser útil quando você deseja:
2020

21-
- Properly trigger lifecycle hooks of a component
22-
- Trigger transitions
21+
- Acionar corretamente ganchos de ciclo de vida de um componente
22+
- Transições de gatilho
2323

24-
For example:
24+
Por exemplo:
2525

2626
```html
2727
<transition>
2828
<span :key="text">{{ text }}</span>
2929
</transition>
3030
```
3131

32-
When `text` changes, the `<span>` will always be replaced instead of patched, so a transition will be triggered.
32+
Quando o `texto` muda, o `<span>` sempre será substituído ao invés de corrigido, então uma transição será disparada.
3333

3434
## ref
3535

36-
- **Expects:** `string | Function`
36+
- **Esperado:** `string | Function`
3737

38-
`ref` is used to register a reference to an element or a child component. The reference will be registered under the parent component's `$refs` object. If used on a plain DOM element, the reference will be that element; if used on a child component, the reference will be component instance:
38+
`ref` é usado para registrar uma referência a um elemento ou componente filho. A referência será registrada no objeto `$refs` do componente pai. Se usado em um elemento DOM simples, a referência será esse elemento; se usado em um componente filho, a referência será a instância do componente:
3939

4040
```html
41-
<!-- vm.$refs.p will be the DOM node -->
42-
<p ref="p">hello</p>
41+
<!-- vm.$refs.p será o nó DOM -->
42+
<p ref="p">Olá</p>
4343

44-
<!-- vm.$refs.child will be the child component instance -->
44+
<!-- vm.$refs.child será a instância do componente filho -->
4545
<child-component ref="child"></child-component>
4646

47-
<!-- When bound dynamically, we can define ref as a callback function, passing the element or component instance explicitly -->
47+
<!-- Quando vinculado dinamicamente, podemos definir "ref" como uma função de "callback"(retorno de chamada), passando o elemento ou instância do componente explicitamente -->
4848
<child-component :ref="(el) => child = el"></child-component>
4949
```
5050

51-
An important note about the ref registration timing: because the refs themselves are created as a result of the render function, you cannot access them on the initial render - they don't exist yet! `$refs` is also non-reactive, therefore you should not attempt to use it in templates for data-binding.
51+
Uma observação importante sobre o tempo de registro de uma "ref": como as próprias refs são criadas como resultado da função de renderização, você não pode acessá-los na renderização inicial - eles ainda não existem! `$refs` também não é reativo, portanto, você não deve tentar usá-lo em modelos para vinculação de dados.
5252

53-
- **See also:** [Child Component Refs](../guide/component-template-refs.html)
53+
- **Veja também:** [Refs de Componente Filho](../guide/component-template-refs.html)
5454

5555
## is
5656

57-
- **Expects:** `string | Object (component’s options object)`
57+
- **Esperado:** `string | Object (objeto de opções do componente)`
5858

59-
Used for [dynamic components](../guide/component-dynamic-async.html).
59+
Usado para [componentes dinâmicos](../guide/component-dynamic-async.html).
6060

61-
For example:
61+
Por exemplo:
6262

6363
```html
64-
<!-- component changes when currentView changes -->
64+
<!-- componente muda quando currentView muda -->
6565
<component :is="currentView"></component>
6666
```
6767

68-
- **See also:**
69-
- [Dynamic Components](../guide/component-dynamic-async.html)
70-
- [DOM Template Parsing Caveats](../guide/component-basics.html#dom-template-parsing-caveats)
68+
- **Veja também:**
69+
- [Componentes Dinâmicos](../guide/component-dynamic-async.html)
70+
- [Advertências de análise de modelo DOM](../guide/component-basics.html#dom-template-parsing-caveats)

0 commit comments

Comments
 (0)