Skip to content

Commit fb526b1

Browse files
authored
docs: add portuguese translation to conditional section
1 parent dbcf975 commit fb526b1

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/guide/conditional.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
1-
# Conditional Rendering
1+
# Renderização Condicional
22

33
## `v-if`
44

5-
The directive `v-if` is used to conditionally render a block. The block will only be rendered if the directive's expression returns a truthy value.
5+
A diretiva `v-if` é usada para renderizar condicionalmente um bloco. O bloco só será renderizado se a expressão da diretiva retornar um valor verdadeiro.
66

77
```html
8-
<h1 v-if="awesome">Vue is awesome!</h1>
8+
<h1 v-if="awesome">Vue é incrível!</h1>
99
```
1010

11-
It is also possible to add an "else block" with `v-else`:
11+
Também é possível adicionar um "bloco senão" usando `v-else`:
1212

1313
```html
14-
<h1 v-if="awesome">Vue is awesome!</h1>
15-
<h1 v-else>Oh no 😢</h1>
14+
<h1 v-if="awesome">Vue é incrível!</h1>
15+
<h1 v-else>Oh não 😢</h1>
1616
```
1717

18-
### Conditional Groups with `v-if` on `<template>`
18+
### Grupos Condicionais com `v-if` em `<template>`
1919

20-
Because `v-if` is a directive, it has to be attached to a single element. But what if we want to toggle more than one element? In this case we can use `v-if` on a `<template>` element, which serves as an invisible wrapper. The final rendered result will not include the `<template>` element.
20+
Como `v-if` é uma diretiva, então deve ser anexado a um único elemento. E se quisermos alternar mais de um elemento? Nesse caso podemos usar `v-if` em um elemento `<template>`, que serve como um invólucro invisível. O resultado final renderizado não incluirá o elemento `<template>`.
2121

2222
```html
2323
<template v-if="ok">
24-
<h1>Title</h1>
25-
<p>Paragraph 1</p>
26-
<p>Paragraph 2</p>
24+
<h1>Título</h1>
25+
<p>Parágrafo 1</p>
26+
<p>Parágrafo 2</p>
2727
</template>
2828
```
2929

3030
### `v-else`
3131

32-
You can use the `v-else` directive to indicate an "else block" for `v-if`:
32+
É possível utilizar a diretiva `v-else` para indicar um "bloco _else_" para `v-if`:
3333

3434
```html
3535
<div v-if="Math.random() > 0.5">
36-
Now you see me
36+
Agora você me vê
3737
</div>
3838
<div v-else>
39-
Now you don't
39+
Agora você não me vê
4040
</div>
4141
```
4242

43-
A `v-else` element must immediately follow a `v-if` or a `v-else-if` element - otherwise it will not be recognized.
43+
Um elemento `v-else` deve vir imediatamente após um elemento `v-if` ou `v-else-if`, caso contrário não será reconhecido.
4444

4545
### `v-else-if`
4646

47-
The `v-else-if`, as the name suggests, serves as an "else if block" for `v-if`. It can also be chained multiple times:
47+
O `v-else-if`, como o nome sugere, serve como um "bloco _else if_" ao `v-if`. Ele pode, inclusive, ser encadeado várias vezes:
4848

4949
```html
5050
<div v-if="type === 'A'">
@@ -57,38 +57,38 @@ The `v-else-if`, as the name suggests, serves as an "else if block" for `v-if`.
5757
C
5858
</div>
5959
<div v-else>
60-
Not A/B/C
60+
Não A, B ou C
6161
</div>
6262
```
6363

64-
Similar to `v-else`, a `v-else-if` element must immediately follow a `v-if` or a `v-else-if` element.
64+
Similar ao `v-else`, um `v-else-if` deve vir imediatamente após um elemento `v-if` ou um elemento `v-else-if`.
6565

6666
## `v-show`
6767

68-
Another option for conditionally displaying an element is the `v-show` directive. The usage is largely the same:
68+
Outra opção para exibir condicionalmente um elemento é a diretiva `v-show`. A utilização é basicamente a mesma.
6969

7070
```html
71-
<h1 v-show="ok">Hello!</h1>
71+
<h1 v-show="ok">Olá!</h1>
7272
```
7373

74-
The difference is that an element with `v-show` will always be rendered and remain in the DOM; `v-show` only toggles the `display` CSS property of the element.
74+
A diferença é que um elemento com `v-show` sempre será renderizado e permanecerá no DOM; `v-show` simplesmente alterna a propriedade CSS `display` do elemento.
7575

76-
`v-show` doesn't support the `<template>` element, nor does it work with `v-else`.
76+
`v-show` não suporta o elemento `<template>`, nem funciona com `v-else`.
7777

7878
## `v-if` vs `v-show`
7979

80-
`v-if` is "real" conditional rendering because it ensures that event listeners and child components inside the conditional block are properly destroyed and re-created during toggles.
80+
`v-if` é a renderização condicional "real", pois garante que eventos e componentes filhos dentro do bloco condicional sejam devidamente destruídos e recriados durante a alternância.
8181

82-
`v-if` is also **lazy**: if the condition is false on initial render, it will not do anything - the conditional block won't be rendered until the condition becomes true for the first time.
82+
`v-if` também é **preguiçoso**: se a condição for _false_ na renderização inicial, nada será feito - o bloco condicional não será renderizado até que a condição se torne _true_ pela primeira vez.
8383

84-
In comparison, `v-show` is much simpler - the element is always rendered regardless of initial condition, with CSS-based toggling.
84+
Em comparação, `v-show` é mais simples - o elemento sempre será renderizado independentemente da condição inicial, com alternância baseada em CSS.
8585

86-
Generally speaking, `v-if` has higher toggle costs while `v-show` has higher initial render costs. So prefer `v-show` if you need to toggle something very often, and prefer `v-if` if the condition is unlikely to change at runtime.
86+
De modo geral, `v-if` tem custo maior nas alternâncias de renderização, enquanto que `v-show` tem custo maior na renderização inicial. Então prefira `v-show` se precisar alternar a visibilidade de algo com muita frequência, e prefira `v-if` se não é muito provável que a condição se altere durante a execução.
8787

8888
## `v-if` with `v-for`
8989

9090
::: tip Note
91-
Using `v-if` and `v-for` together is **not recommended**. See the [style guide](../style-guide/#avoid-v-if-with-v-for-essential) for further information.
91+
Usar `v-if` e `v-for` juntos **não é recomendado**. Veja o [guia de estilos](../style-guide/#avoid-v-if-with-v-for-essential) para mais informações.
9292
:::
9393

94-
When used together with `v-if`, `v-for` has a higher priority than `v-if`. See the [list rendering guide](list#v-for-with-v-if) for details.
94+
Quando usado em conjunto com `v-if`, `v-for` possui maior prioridade do que `v-if`. Veja o [guia renderização de listas](list#v-for-with-v-if) para mais detalhes.

0 commit comments

Comments
 (0)