You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/guide/render-function.md
+31-32Lines changed: 31 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -240,20 +240,19 @@ render() {
240
240
}
241
241
```
242
242
243
-
## Replacing Template Features with Plain JavaScript
243
+
## Substituíndo Templates de recursos por JavaScript Simples
244
+
### `v-if` e `v-for`
244
245
245
-
### `v-if` and `v-for`
246
-
247
-
Wherever something can be easily accomplished in plain JavaScript, Vue render functions do not provide a proprietary alternative. For example, in a template using `v-if` and `v-for`:
246
+
Sempre que algo for facilmente realizado usando JavaScript simples, as funções de renderização do Vue não são uma alternativa apropriada. Por exemplo, em um template usando `v-if` e `v-for`:
248
247
249
248
```html
250
249
<ulv-if="items.length">
251
250
<liv-for="item in items">{{ item.name }}</li>
252
251
</ul>
253
-
<pv-else>No items found.</p>
252
+
<pv-else>Não foram encontrados itens.</p>
254
253
```
255
254
256
-
This could be rewritten with JavaScript's `if`/`else`and`map()`in a render function:
255
+
Pode ser rescrito usando usando `if`/`else`e`map()`com JavaScript em uma função de renderização:
257
256
258
257
```js
259
258
props: ['items'],
@@ -263,14 +262,14 @@ render() {
263
262
returnVue.h('li', item.name)
264
263
}))
265
264
} else {
266
-
returnVue.h('p', 'No items found.')
265
+
returnVue.h('p', 'Não foram encontrados itens.')
267
266
}
268
267
}
269
268
```
270
269
271
270
### `v-model`
272
271
273
-
The `v-model`directive is expanded to `modelValue` and `onUpdate:modelValue`props during template compilation—we will have to provide these props ourselves:
272
+
A diretiva `v-model`é expandida para as propriedades `modelValue`e `onUpdate:modelValue`durante a compilação do template - nós mesmos teremos que prover essas propriedades:
274
273
275
274
```js
276
275
props: ['modelValue'],
@@ -284,7 +283,7 @@ render() {
284
283
285
284
### `v-on`
286
285
287
-
We have to provide a proper prop name for the event handler, e.g., to handle `click` events, the prop name would be`onClick`.
286
+
Temos que prover o propriedade com nome apropriado para o manipulador do evento, e.g., para manipular um evento de `click`, o nome da propriedade deve ser`onClick`.
288
287
289
288
```js
290
289
render() {
@@ -294,11 +293,11 @@ render() {
294
293
}
295
294
```
296
295
297
-
#### Event Modifiers
296
+
#### Modificadores de Eventos
298
297
299
-
For the `.passive`, `.capture`, and`.once` event modifiers, they can be concatenated after event name using camel case.
298
+
Os modificadores de evento `.passive`, `.capture` e`.once`, podem ser concatenados após o nome do evento usando grafia camelo (_camel case_).
300
299
301
-
For example:
300
+
Por exemplo:
302
301
303
302
```javascript
304
303
render() {
@@ -310,32 +309,32 @@ render() {
310
309
}
311
310
```
312
311
313
-
For all other event and key modifiers, no special API is necessary, because we can use event methods in the handler:
312
+
Para todos os outros modificadores de evento, não é necessária nenhuma API especial, pois podemos usar métodos de evento no manipulador:
0 commit comments