|
6 | 6 |
|
7 | 7 | - **Detalhes:**
|
8 | 8 |
|
9 |
| - Updates the element's [textContent](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent). If you need to update the part of `textContent`, you should use [mustache interpolations](/guide/template-syntax.html#text) instead |
| 9 | + Atualiza o [textContent](https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent) do elemento. Se você precisa atualizar a parte de `textContent`, você deve usar [interpolações mustache](/guide/template-syntax.html#text). |
10 | 10 |
|
11 | 11 | - **Exemplo:**
|
12 | 12 |
|
13 | 13 | ```html
|
14 | 14 | <span v-text="msg"></span>
|
15 |
| - <!-- same as --> |
| 15 | + <!-- o mesmo que --> |
16 | 16 | <span>{{msg}}</span>
|
17 | 17 | ```
|
18 | 18 |
|
19 |
| -- **Ver também:** [Data Binding Syntax - Interpolations](../guide/template-syntax.html#text) |
| 19 | +- **Ver também:** [Sintaxe de Templates - Interpolações](../guide/template-syntax.html#text) |
20 | 20 |
|
21 | 21 | ## v-html
|
22 | 22 |
|
23 | 23 | - **Espera:** `string`
|
24 | 24 |
|
25 | 25 | - **Detalhes:**
|
26 | 26 |
|
27 |
| - Updates the element's [innerHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML). **Note that the contents are inserted as plain HTML - they will not be compiled as Vue templates**. If you find yourself trying to compose templates using `v-html`, try to rethink the solution by using components instead. |
| 27 | + Atualiza o [innerHTML](https://developer.mozilla.org/en-US/docs/Web/API/Element/innerHTML) do elemento. **Perceba que os conteúdos são inseridos como HTML puro - eles não serão compilados como templates Vue**. Se você se encontra tentando compor templates usando `v-html`, tente repensar a solução usando componentes em vez disso. |
28 | 28 |
|
29 | 29 | ::: warning
|
30 |
| - Dynamically rendering arbitrary HTML on your website can be very dangerous because it can easily lead to [XSS attacks](https://en.wikipedia.org/wiki/Cross-site_scripting). Only use `v-html` on trusted content and **never** on user-provided content. |
| 30 | + Renderizar dinamicamente HTML arbitrário em seu website pode ser muito perigoso porque isso pode facilmente levar a [ataques XSS](https://en.wikipedia.org/wiki/Cross-site_scripting). Apenas use `v-html` em conteúdo confiável e **nunca** em conteúdo fornecido por usuário. |
31 | 31 | :::
|
32 | 32 |
|
33 |
| - In [single-file components](../guide/single-file-component.html), `scoped` styles will not apply to content inside `v-html`, because that HTML is not processed by Vue's template compiler. If you want to target `v-html` content with scoped CSS, you can instead use [CSS modules](https://vue-loader.vuejs.org/en/features/css-modules.html) or an additional, global `<style>` element with a manual scoping strategy such as BEM. |
| 33 | + Em [Componentes Single File](../guide/single-file-component.html), estilos `scoped` não serão aplicados a conteúdos `v-html`, pois tal HTML não é processado pelo compilador de templates do Vue. Se você quer atingir conteúdo `v-html` com CSS com escopo, é possível utilizar [CSS modules](https://vue-loader.vuejs.org/en/features/css-modules.html) ou um elemento global adicional `<style>` , com uma estratégia manual de escopo como BEM. |
34 | 34 |
|
35 | 35 | - **Exemplo:**
|
36 | 36 |
|
37 | 37 | ```html
|
38 | 38 | <div v-html="html"></div>
|
39 | 39 | ```
|
40 | 40 |
|
41 |
| -- **Ver também:** [Data Binding Syntax - Interpolations](../guide/template-syntax.html#raw-html) |
| 41 | +- **Ver também:** [Sintaxe de Templates - Interpolações](../guide/template-syntax.html#raw-html) |
42 | 42 |
|
43 | 43 | ## v-show
|
44 | 44 |
|
45 | 45 | - **Espera:** `any`
|
46 | 46 |
|
47 | 47 | - **Uso:**
|
48 | 48 |
|
49 |
| - Toggles the element's `display` CSS property based on the truthy-ness of the expression value. |
| 49 | + Alterna a propriedade CSS `display` do elemento baseado na condição de verdade do valor da expressão. |
50 | 50 |
|
51 |
| - This directive triggers transitions when its condition changes. |
| 51 | + Esta diretiva dispara transições quando sua condição muda. |
52 | 52 |
|
53 |
| -- **Ver também:** [Conditional Rendering - v-show](../guide/conditional.html#v-show) |
| 53 | +- **Ver também:** [Renderização Condicional - v-show](../guide/conditional.html#v-show) |
54 | 54 |
|
55 | 55 | ## v-if
|
56 | 56 |
|
57 | 57 | - **Espera:** `any`
|
58 | 58 |
|
59 | 59 | - **Uso:**
|
60 | 60 |
|
61 |
| - Conditionally render the element based on the truthy-ness of the expression value. The element and its contained directives / components are destroyed and re-constructed during toggles. If the element is a `<template>` element, its content will be extracted as the conditional block. |
| 61 | + Renderiza condicionalmente o elemento baseado na condição de verdade do valor da expressão. O elemento e suas diretivas/componentes contidos são destruídos e reconstruídos durante alternâncias (*toggles*). Se o elemento é um `<template>`, o seu conteúdo será extraído como o bloco condicional. |
62 | 62 |
|
63 |
| - This directive triggers transitions when its condition changes. |
| 63 | + Esta diretiva dispara transições quando sua condição muda. |
64 | 64 |
|
65 |
| - When used together, `v-if` has a higher priority than `v-for`. We don't recommend using these two directives together on one element — see the [list rendering guide](../guide/list.html#v-for-with-v-if) for details. |
| 65 | + Quando usada em conjunto com `v-if`, `v-for` tem uma prioridade maior. Não recomendamos o uso dessas duas diretivas juntas em um elemento - consulte a [guia de renderização de listas](../guide/list.html#v-for-with-v-if) para obter detalhes. |
66 | 66 |
|
67 |
| -- **Ver também:** [Conditional Rendering - v-if](../guide/conditional.html#v-if) |
| 67 | +- **Ver também:** [Renderização Condicional - v-if](../guide/conditional.html#v-if) |
68 | 68 |
|
69 | 69 | ## v-else
|
70 | 70 |
|
71 | 71 | - **Não espera expressão**
|
72 | 72 |
|
73 |
| -- **Restriction:** previous sibling element must have `v-if` or `v-else-if`. |
| 73 | +- **Restriction:** o elemento-irmão anterior deve ter `v-if` ou `v-else-if`. |
74 | 74 |
|
75 | 75 | - **Uso:**
|
76 | 76 |
|
77 |
| - Denote the "else block" for `v-if` or a `v-if`/`v-else-if` chain. |
| 77 | + Significa o bloco "senão" de uma cadeia `v-if` ou `v-if`/`v-else-if`. |
78 | 78 |
|
79 | 79 | ```html
|
80 | 80 | <div v-if="Math.random() > 0.5">
|
81 |
| - Now you see me |
| 81 | + Agora você me vê |
82 | 82 | </div>
|
83 | 83 | <div v-else>
|
84 |
| - Now you don't |
| 84 | + Agora você não me vê |
85 | 85 | </div>
|
86 | 86 | ```
|
87 | 87 |
|
88 |
| -- **Ver também:** [Conditional Rendering - v-else](../guide/conditional.html#v-else) |
| 88 | +- **Ver também:** [Renderização Condicional - v-else](../guide/conditional.html#v-else) |
89 | 89 |
|
90 | 90 | ## v-else-if
|
91 | 91 |
|
92 | 92 | - **Espera:** `any`
|
93 | 93 |
|
94 |
| -- **Restriction:** previous sibling element must have `v-if` or `v-else-if`. |
| 94 | +- **Restriction:** o elemento-irmão anterior deve ter `v-if` ou `v-else-if`. |
95 | 95 |
|
96 | 96 | - **Uso:**
|
97 | 97 |
|
98 |
| - Denote the "else if block" for `v-if`. Can be chained. |
| 98 | + Significa o bloco "senão caso" para `v-if`. Pode ser encadeado. |
99 | 99 |
|
100 | 100 | ```html
|
101 | 101 | <div v-if="type === 'A'">
|
|
108 | 108 | C
|
109 | 109 | </div>
|
110 | 110 | <div v-else>
|
111 |
| - Not A/B/C |
| 111 | + Não A/B/C |
112 | 112 | </div>
|
113 | 113 | ```
|
114 | 114 |
|
115 |
| -- **Ver também:** [Conditional Rendering - v-else-if](../guide/conditional.html#v-else-if) |
| 115 | +- **Ver também:** [Renderização Condicional - v-else-if](../guide/conditional.html#v-else-if) |
116 | 116 |
|
117 | 117 | ## v-for
|
118 | 118 |
|
119 | 119 | - **Espera:** `Array | Object | number | string | Iterable`
|
120 | 120 |
|
121 | 121 | - **Uso:**
|
122 | 122 |
|
123 |
| - Render the element or template block multiple times based on the source data. The directive's value must use the special syntax `alias in expression` to provide an alias for the current element being iterated on: |
| 123 | + Renderiza o elemento ou bloco de template múltiplas vezes baseado nos dados de origem (*source data*). O valor da diretiva deve usar a sintaxe especial `alias in expression` para fornecer um alias para o elemento atual ser iterado em: |
124 | 124 |
|
125 | 125 | ```html
|
126 | 126 | <div v-for="item in items">
|
127 | 127 | {{ item.text }}
|
128 | 128 | </div>
|
129 | 129 | ```
|
130 | 130 |
|
131 |
| - Alternatively, you can also specify an alias for the index (or the key if used on an Object): |
| 131 | + Alternativamente, você também pode especificar um alias para o índice (ou a chave, se usada em um Objeto): |
132 | 132 |
|
133 | 133 | ```html
|
134 | 134 | <div v-for="(item, index) in items"></div>
|
135 | 135 | <div v-for="(value, key) in object"></div>
|
136 | 136 | <div v-for="(value, name, index) in object"></div>
|
137 | 137 | ```
|
138 | 138 |
|
139 |
| - The default behavior of `v-for` will try to patch the elements in-place without moving them. To force it to reorder elements, you should provide an ordering hint with the `key` special attribute: |
| 139 | + O comportamento padrão de `v-for` tentará corrigir os elementos no local sem os mover. Para forçá-lo a reordenar elementos, você precisa fornecer uma sugestão de ordenação com o atributo especial `key`: |
140 | 140 |
|
141 | 141 | ```html
|
142 | 142 | <div v-for="item in items" :key="item.id">
|
143 | 143 | {{ item.text }}
|
144 | 144 | </div>
|
145 | 145 | ```
|
146 | 146 |
|
147 |
| - `v-for` can also work on values that implement the [Iterable Protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol), including native `Map` and `Set`. |
| 147 | + `v-for` também pode trabalhar em valores que implementam o [Protocolo Iterável](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol), incluindo `Map` e `Set` nativos. |
148 | 148 |
|
149 |
| - The detailed usage for `v-for` is explained in the guide section linked below. |
| 149 | + O uso detalhado de `v-for` é explicado na seção de Guia com link abaixo. |
150 | 150 |
|
151 | 151 | - **Ver também:**
|
152 |
| - - [List Rendering](../guide/list.html) |
| 152 | + - [Renderização de Listas](../guide/list.html) |
153 | 153 |
|
154 | 154 | ## v-on
|
155 | 155 |
|
|
161 | 161 |
|
162 | 162 | - **Modificadores:**
|
163 | 163 |
|
164 |
| - - `.stop` - call `event.stopPropagation()`. |
165 |
| - - `.prevent` - call `event.preventDefault()`. |
166 |
| - - `.capture` - add event listener in capture mode. |
167 |
| - - `.self` - only trigger handler if event was dispatched from this element. |
168 |
| - - `.{keyAlias}` - only trigger handler on certain keys. |
169 |
| - - `.once` - trigger handler at most once. |
170 |
| - - `.left` - only trigger handler for left button mouse events. |
171 |
| - - `.right` - only trigger handler for right button mouse events. |
172 |
| - - `.middle` - only trigger handler for middle button mouse events. |
173 |
| - - `.passive` - attaches a DOM event with `{ passive: true }`. |
| 164 | + - `.stop` - chama `event.stopPropagation()`. |
| 165 | + - `.prevent` - chama `event.preventDefault()`. |
| 166 | + - `.capture` - adiciona escuta de eventos em modo de captura. |
| 167 | + - `.self` - aciona o manipulador somente se o evento foi disparado a partir deste elemento. |
| 168 | + - `.{keyAlias}` - aciona o manipulador apenas em certas chaves. |
| 169 | + - `.once` - aciona o manipulador somente uma vez. |
| 170 | + - `.left` - aciona o manipulador somente para eventos do botão esquerdo do mouse. |
| 171 | + - `.right` - aciona o manipulador somente para eventos do botão direito do mouse. |
| 172 | + - `.middle` - aciona o manipulador somente para eventos do botão do meio do mouse. |
| 173 | + - `.passive` - atribui um evento ao DOM com `{ passive: true }`. |
174 | 174 |
|
175 | 175 | - **Uso:**
|
176 | 176 |
|
177 |
| - Attaches an event listener to the element. The event type is denoted by the argument. The expression can be a method name, an inline statement, or omitted if there are modifiers present. |
| 177 | + Atribui uma escuta de evento ao elemento. O tipo de evento é indicado pelo argumento. A expressão pode ser um nome de método, uma declaração *inline*, ou omitida quando há modificadores presentes. |
178 | 178 |
|
179 |
| - When used on a normal element, it listens to [**native DOM events**](https://developer.mozilla.org/en-US/docs/Web/Events) only. When used on a custom element component, it listens to **custom events** emitted on that child component. |
| 179 | + Quando usada em um elemento normal, escuta somente [**eventos nativos de DOM**](https://developer.mozilla.org/en-US/docs/Web/Events). Quando usada em um componente de elemento personalizado, escuta **eventos personalizados** emitidos naquele componente-filho. |
180 | 180 |
|
181 |
| - When listening to native DOM events, the method receives the native event as the only argument. If using inline statement, the statement has access to the special `$event` property: `v-on:click="handle('ok', $event)"`. |
| 181 | + Quando escutando a eventos nativos de DOM, o método recebe o evento nativo como argumento único. Quando usada declaração *inline*, ela tem acesso à propriedade especial `$event`: `v-on:click="handle('ok', $event)"`. |
182 | 182 |
|
183 | 183 | `v-on` also supports binding to an object of event/listener pairs without an argument. Note when using the object syntax, it does not support any modifiers.
|
184 | 184 |
|
185 | 185 | - **Exemplo:**
|
186 | 186 |
|
187 | 187 | ```html
|
188 |
| - <!-- method handler --> |
| 188 | + <!-- manipulador de método --> |
189 | 189 | <button v-on:click="doThis"></button>
|
190 | 190 |
|
191 |
| - <!-- dynamic event --> |
| 191 | + <!-- evento dinâmico --> |
192 | 192 | <button v-on:[event]="doThis"></button>
|
193 | 193 |
|
194 |
| - <!-- inline statement --> |
| 194 | + <!-- declaração inline --> |
195 | 195 | <button v-on:click="doThat('hello', $event)"></button>
|
196 | 196 |
|
197 |
| - <!-- shorthand --> |
| 197 | + <!-- forma abreviada --> |
198 | 198 | <button @click="doThis"></button>
|
199 | 199 |
|
200 |
| - <!-- shorthand dynamic event --> |
| 200 | + <!-- forma abreviada para o evento dinâmico --> |
201 | 201 | <button @[event]="doThis"></button>
|
202 | 202 |
|
203 |
| - <!-- stop propagation --> |
| 203 | + <!-- para a propagação --> |
204 | 204 | <button @click.stop="doThis"></button>
|
205 | 205 |
|
206 |
| - <!-- prevent default --> |
| 206 | + <!-- previne padrão --> |
207 | 207 | <button @click.prevent="doThis"></button>
|
208 | 208 |
|
209 |
| - <!-- prevent default without expression --> |
| 209 | + <!-- previne padrão sem expressão --> |
210 | 210 | <form @submit.prevent></form>
|
211 | 211 |
|
212 |
| - <!-- chain modifiers --> |
| 212 | + <!-- modificador em cadeia --> |
213 | 213 | <button @click.stop.prevent="doThis"></button>
|
214 | 214 |
|
215 |
| - <!-- key modifier using keyAlias --> |
| 215 | + <!-- modificador de chave usando keyAlias --> |
216 | 216 | <input @keyup.enter="onEnter" />
|
217 | 217 |
|
218 |
| - <!-- the click event will be triggered at most once --> |
| 218 | + <!-- o evento de clique será acionado somente uma vez --> |
219 | 219 | <button v-on:click.once="doThis"></button>
|
220 | 220 |
|
221 |
| - <!-- object syntax --> |
| 221 | + <!-- sintaxe de objeto --> |
222 | 222 | <button v-on="{ mousedown: doThis, mouseup: doThat }"></button>
|
223 | 223 | ```
|
224 | 224 |
|
225 |
| - Listening to custom events on a child component (the handler is called when "my-event" is emitted on the child): |
| 225 | + Escutando eventos personalizados em um componente-filho (o manipulador é chamado quando “my-event” é emitido no filho): |
226 | 226 |
|
227 | 227 | ```html
|
228 | 228 | <my-component @my-event="handleThis"></my-component>
|
229 | 229 |
|
230 |
| - <!-- inline statement --> |
| 230 | + <!-- declaração inline --> |
231 | 231 | <my-component @my-event="handleThis(123, $event)"></my-component>
|
232 | 232 | ```
|
233 | 233 |
|
234 | 234 | - **Ver também:**
|
235 |
| - - [Event Handling](../guide/events.html) |
236 |
| - - [Components - Custom Events](../guide/component-basics.html#listening-to-child-components-events) |
| 235 | + - [Manipulação de Eventos](../guide/events.html) |
| 236 | + - [Componentes - Eventos Personalizados](../guide/component-basics.html#listening-to-child-components-events) |
237 | 237 |
|
238 | 238 | ## v-bind
|
239 | 239 |
|
|
245 | 245 |
|
246 | 246 | - **Modificadores:**
|
247 | 247 |
|
248 |
| - - `.camel` - transform the kebab-case attribute name into camelCase. |
| 248 | + - `.camel` - transforma o nome do atributo de kebab-case para camelCase. |
249 | 249 |
|
250 | 250 | - **Uso:**
|
251 | 251 |
|
|
0 commit comments