|
1 | 1 | # DOM
|
2 | 2 |
|
3 |
| -## template |
| 3 | +## `template` |
4 | 4 |
|
5 |
| -- **Type:** `string` |
| 5 | +- **Tipo:** `string` |
6 | 6 |
|
7 |
| -- **Details:** |
| 7 | +- **Detalhes:** |
8 | 8 |
|
9 |
| - A string template to be used as the markup for the component instance. The template will **replace** the `innerHTML` of mounted element. Any existing markup inside the mounted element will be ignored, unless content distribution slots are present in the template. |
| 9 | + Um _template_ string a ser usado como marcação para a instância do componente. O _template_ **substituirá** o `innerHTML` do elemento montado. Qualquer marcação existente dentro do elemento montado será ignorada, a menos que os _slots_ de distribuição de conteúdo estejam presentes no _template_. |
10 | 10 |
|
11 |
| - If the string starts with `#` it will be used as a `querySelector` and use the selected element's innerHTML as the template string. This allows the use of the common `<script type="x-template">` trick to include templates. |
| 11 | + Se a string começar com `#` ela será usada como um `querySelector` e usará o `innerHTML` do elemento selecionado como a _template_ string. Isso permite o uso do truque comum `<script type="x-template">` para incluir _templates_. |
12 | 12 |
|
13 |
| - :::tip Note |
14 |
| - From a security perspective, you should only use Vue templates that you can trust. Never use user-generated content as your template. |
| 13 | + :::tip Nota |
| 14 | + De uma perspectiva de segurança, você deve usar apenas _templates_ Vue nos quais possa confiar. Nunca use conteúdo gerado pelo usuário como seu _template_. |
15 | 15 | :::
|
16 | 16 |
|
17 |
| - :::tip Note |
18 |
| - If render function is present in the Vue option, the template will be ignored. |
| 17 | + :::tip Nota |
| 18 | + Se a função de renderização estiver presente na opção Vue, o _template_ será ignorado. |
19 | 19 | :::
|
20 | 20 |
|
21 |
| -- **See also:** |
22 |
| - - [Lifecycle Diagram](../guide/instance.html#lifecycle-diagram) |
23 |
| - - [Content Distribution with Slots](../guide/component-basics.html#content-distribution-with-slots) |
| 21 | +- **Ver também:** |
| 22 | + - [Diagrama do ciclo de vida](../guide/instance.html#diagrama-do-ciclo-de-vida) |
| 23 | + - [Distribuição de conteúdo com _slots_](../guide/component-basics.html#distribuicao-de-conteudo-com-slots) |
24 | 24 |
|
25 |
| -## render |
| 25 | +## `render` |
26 | 26 |
|
27 |
| -- **Type:** `Function` |
| 27 | +- **Tipo:** `Function` |
28 | 28 |
|
29 |
| -- **Details:** |
| 29 | +- **Detalhes:** |
30 | 30 |
|
31 |
| - An alternative to string templates allowing you to leverage the full programmatic power of JavaScript. |
| 31 | + Uma alternativa aos _templates_ string, permitindo que você aproveite todo o poder programático do JavaScript. |
32 | 32 |
|
33 |
| -- **Usage:** |
| 33 | +- **Uso:** |
34 | 34 |
|
35 | 35 | ```html
|
36 | 36 | <div id="app" class="demo">
|
37 |
| - <my-title blog-title="A Perfect Vue"></my-title> |
| 37 | + <my-title blog-title="Uma Vue (view) Perfeita"></my-title> |
38 | 38 | </div>
|
39 | 39 | ```
|
40 | 40 |
|
|
45 | 45 | app.component('my-title', {
|
46 | 46 | render() {
|
47 | 47 | return h(
|
48 |
| - 'h1', // tag name, |
49 |
| - this.blogTitle // tag content |
| 48 | + 'h1', // nome da tag, |
| 49 | + this.blogTitle // conteúdo da tag |
50 | 50 | )
|
51 | 51 | },
|
52 | 52 | props: {
|
|
60 | 60 | app.mount('#app')
|
61 | 61 | ```
|
62 | 62 |
|
63 |
| - :::tip Note |
64 |
| - The `render` function has priority over the render function compiled from `template` option or in-DOM HTML template of the mounting element |
| 63 | + :::tip Nota |
| 64 | + A função `render` tem prioridade sobre a função de renderização compilada da opção `template` ou o _template_ HTML no-DOM do elemento sendo montado |
65 | 65 | :::
|
66 | 66 |
|
67 |
| -- **See also:** [Render Functions](../guide/render-function.html) |
| 67 | +- **Ver também:** [Funções de Renderização](../guide/render-function.html) |
0 commit comments