|
1 |
| -# Built-In Components |
| 1 | +# Componentes Integrados |
2 | 2 |
|
3 | 3 | ## component
|
4 | 4 |
|
5 |
| -- **Props:** |
| 5 | +- **Propriedades:** |
6 | 6 |
|
7 | 7 | - `is` - `string | Component`
|
8 | 8 |
|
9 |
| -- **Usage:** |
| 9 | +- **Uso:** |
10 | 10 |
|
11 |
| - A "meta component" for rendering dynamic components. The actual component to render is determined by the `is` prop. An `is` prop as a string could be either an HTML tag name or a Component name. |
| 11 | + Um "meta componente" para renderizar componentes dinâmicos. O componente real a ser renderizado é determinado pela propriedade `is`. Uma propriedade `is` como string pode ser um nome de tag HTML ou um nome de componente. |
12 | 12 |
|
13 |
| -- **Example:** |
| 13 | +- **Exemplo:** |
14 | 14 |
|
15 | 15 | ```html
|
16 |
| - <!-- a dynamic component controlled by --> |
17 |
| - <!-- the `componentId` property on the vm --> |
| 16 | + <!-- um componente dinâmico controlado --> |
| 17 | + <!-- pela propriedade `componentId` na vm --> |
18 | 18 | <component :is="componentId"></component>
|
19 | 19 |
|
20 |
| - <!-- can also render registered component or component passed as prop --> |
| 20 | + <!-- pode também renderizar um componente registrado ou componente passado como propriedade --> |
21 | 21 | <component :is="$options.components.child"></component>
|
22 | 22 |
|
23 |
| - <!-- can reference components by string --> |
| 23 | + <!-- pode referenciar componentes por string --> |
24 | 24 | <component :is="condition ? 'FooComponent' : 'BarComponent'"></component>
|
25 | 25 |
|
26 |
| - <!-- can be used to render native HTML elements --> |
| 26 | + <!-- pode ser usado para renderizar elementos HTML nativos --> |
27 | 27 | <component :is="href ? 'a' : 'span'"></component>
|
28 | 28 | ```
|
29 | 29 |
|
30 |
| -- **See also:** [Dynamic Components](../guide/component-dynamic-async.html) |
| 30 | +- **Ver também:** [Componentes Dinâmicos](../guide/component-dynamic-async.html) |
31 | 31 |
|
32 | 32 | ## transition
|
33 | 33 |
|
34 |
| -- **Props:** |
| 34 | +- **Propriedades:** |
35 | 35 |
|
36 |
| - - `name` - `string` Used to automatically generate transition CSS class names. e.g. `name: 'fade'` will auto expand to `.fade-enter`, `.fade-enter-active`, etc. |
37 |
| - - `appear` - `boolean`, Whether to apply transition on initial render. Defaults to `false`. |
38 |
| - - `persisted` - `boolean`. If true, indicates this is a transition that doesn't actually insert/remove the element, but toggles the show / hidden status instead. The transition hooks are injected, but will be skipped by the renderer. Instead, a custom directive can control the transition by calling the injected hooks (e.g. `v-show`). |
39 |
| - - `css` - `boolean`. Whether to apply CSS transition classes. Defaults to `true`. If set to `false`, will only trigger JavaScript hooks registered via component events. |
40 |
| - - `type` - `string`. Specifies the type of transition events to wait for to determine transition end timing. Available values are `"transition"` and `"animation"`. By default, it will automatically detect the type that has a longer duration. |
41 |
| - - `mode` - `string` Controls the timing sequence of leaving/entering transitions. Available modes are `"out-in"` and `"in-out"`; defaults to simultaneous. |
42 |
| - - `duration` - `number | {`enter`: number,`leave`: number }`. Specifies the duration of transition. By default, Vue waits for the first `transitionend` or `animationend` event on the root transition element. |
| 36 | + - `name` - `string` Usado para gerar automaticamente nomes de classes CSS de transições. Por exemplo, `name: 'fade'` expandirá automaticamente para `.fade-enter`, `.fade-enter-active`, etc. |
| 37 | + - `appear` - `boolean`, Se a transição deve ser aplicada na renderização inicial deverá ser configurado para `true`. Por padrão, `false`. |
| 38 | + - `persisted` - `boolean`. Se estiver `true`, indica que esta transição não insere/remove realmente o elemento, mas alterna o status entre mostrar/esconder. Os gatilhos de transição são injetados, mas serão ignorados pelo renderizador. Em vez disso, uma diretiva personalizada pode controlar a transição chamando os gatilhos injetados (por exemplo `v-show`). |
| 39 | + - `css` - `boolean`. Aplicar ou não classes de transição CSS. Por padrão é `true`. Se configurado para `false`, apenas acionará gatilhos registrados no JavaScript por meio de eventos de componentes. |
| 40 | + - `type` - `string`. Especifica o tipo de eventos de transição a serem aguardados para determinar o tempo de término da transição. Os valores disponíveis são `"transition"` and `"animation"`. Por padrão, será detectado automaticamente o tipo que tenha uma duração mais longa. |
| 41 | + - `mode` - `string`. Controla a sequência de temporização das transições de saída/entrada. Modos disponíveis são `"out-in"` e `"in-out"`; o padrão é simultâneo. |
| 42 | + - `duration` - `number | {`enter`: number,`leave`: number }`. Especifica a duração da transição. Por padrão, o Vue aguarda o primeiro evento de `transitionend` ou `animationend` no elemento de transição raiz. |
43 | 43 | - `enter-from-class` - `string`
|
44 | 44 | - `leave-from-class` - `string`
|
45 | 45 | - `appear-class` - `string`
|
|
50 | 50 | - `leave-active-class` - `string`
|
51 | 51 | - `appear-active-class` - `string`
|
52 | 52 |
|
53 |
| -- **Events:** |
| 53 | +- **Eventos:** |
54 | 54 |
|
55 | 55 | - `before-enter`
|
56 | 56 | - `before-leave`
|
|
61 | 61 | - `after-leave`
|
62 | 62 | - `after-appear`
|
63 | 63 | - `enter-cancelled`
|
64 |
| - - `leave-cancelled` (`v-show` only) |
| 64 | + - `leave-cancelled` (apenas `v-show`) |
65 | 65 | - `appear-cancelled`
|
66 | 66 |
|
67 |
| -- **Usage:** |
| 67 | +- **Uso:** |
68 | 68 |
|
69 |
| - `<transition>` serve as transition effects for **single** element/component. The `<transition>` only applies the transition behavior to the wrapped content inside; it doesn't render an extra DOM element, or show up in the inspected component hierarchy. |
| 69 | + `<transition>` servem como efeitos de transição para elemento/componente **único**. O `<transition>` aplica apenas o comportamento de transição para o conteúdo dentro do *wrapper*; Ele não renderiza um elemento DOM extra ou aparece na hierarquia dos componentes inspecionados. |
70 | 70 |
|
71 | 71 | ```html
|
72 |
| - <!-- simple element --> |
| 72 | + <!-- elemento simples --> |
73 | 73 | <transition>
|
74 |
| - <div v-if="ok">toggled content</div> |
| 74 | + <div v-if="ok">conteúdo alternado</div> |
75 | 75 | </transition>
|
76 | 76 |
|
77 |
| - <!-- dynamic component --> |
| 77 | + <!-- componente dinâmico --> |
78 | 78 | <transition name="fade" mode="out-in" appear>
|
79 | 79 | <component :is="view"></component>
|
80 | 80 | </transition>
|
81 | 81 |
|
82 |
| - <!-- event hooking --> |
| 82 | + <!-- gatilhos de evento --> |
83 | 83 | <div id="transition-demo">
|
84 | 84 | <transition @after-enter="transitionComplete">
|
85 |
| - <div v-show="ok">toggled content</div> |
| 85 | + <div v-show="ok">conteúdo alternado</div> |
86 | 86 | </transition>
|
87 | 87 | </div>
|
88 | 88 | ```
|
|
92 | 92 | ...
|
93 | 93 | methods: {
|
94 | 94 | transitionComplete (el) {
|
95 |
| - // for passed 'el' that DOM element as the argument, something ... |
| 95 | + // para o 'el' passado que é um elemento do DOM como um argumento ... |
96 | 96 | }
|
97 | 97 | }
|
98 | 98 | ...
|
|
101 | 101 | app.mount('#transition-demo')
|
102 | 102 | ```
|
103 | 103 |
|
104 |
| -- **See also:** [Enter & Leave Transitions](/guide/transitions-enterleave.html#transitioning-single-elements-components) |
| 104 | +- **Ver também:** [Transições de entrada e saída](/guide/transitions-enterleave.html#transicao-de-elementos-componentes-unicos) |
105 | 105 |
|
106 | 106 | ## transition-group
|
107 | 107 |
|
108 |
| -- **Props:** |
| 108 | +- **Propriedades:** |
109 | 109 |
|
110 |
| - - `tag` - `string`, defaults to `span`. |
111 |
| - - `move-class` - overwrite CSS class applied during moving transition. |
112 |
| - - exposes the same props as `<transition>` except `mode`. |
| 110 | + - `tag` - `string`, `span` como padrão. |
| 111 | + - `move-class` - substitui a classe CSS aplicada durante a transição em movimento. |
| 112 | + - expõe as mesmas propriedades que `<transition>` exceto `mode`. |
113 | 113 |
|
114 |
| -- **Events:** |
| 114 | +- **Eventos:** |
115 | 115 |
|
116 |
| - - exposes the same events as `<transition>`. |
| 116 | + - expõe os mesmos eventos que `<transition>`. |
117 | 117 |
|
118 |
| -- **Usage:** |
| 118 | +- **Uso:** |
119 | 119 |
|
120 |
| - `<transition-group>` serve as transition effects for **multiple** elements/components. The `<transition-group>` renders a real DOM element. By default it renders a `<span>`, and you can configure what element it should render via the `tag` attribute. |
| 120 | + `<transition-group>` serve como efeito de transição para **múltiplos** elementos/componentes. O `<transition-group>` renderiza um elemento DOM real. Por padrão renderiza um `<span>`, e você pode configurar qual elemento deverá ser renderizado através do atributo `tag`. |
121 | 121 |
|
122 |
| - Note that every child in a `<transition-group>` must be [**uniquely keyed**](./special-attributes.html#key) for the animations to work properly. |
| 122 | + Note que cada filho em um `<transition-group>` deve ser identificado com [**chave única**](./special-attributes.html#key) para as animações funcionarem corretamente. |
123 | 123 |
|
124 |
| - `<transition-group>` supports moving transitions via CSS transform. When a child's position on screen has changed after an update, it will get applied a moving CSS class (auto generated from the `name` attribute or configured with the `move-class` attribute). If the CSS `transform` property is "transition-able" when the moving class is applied, the element will be smoothly animated to its destination using the [FLIP technique](https://aerotwist.com/blog/flip-your-animations/). |
| 124 | + `<transition-group>` suporta transições de movimento via transformações CSS. Quando a posição de um elemento filho na tela muda após uma atualização, ele aplicará uma classe de movimento CSS (gerada automaticamente a partir do atributo `name` ou configurada com o atributo `move-class` ). Se a propriedade CSS `transform` for passível de transição quando a classe de movimento é aplicada, o elemento será animado suavemente para o seu destino usando a [técnica FLIP](https://aerotwist.com/blog/flip-your-animations/). |
125 | 125 |
|
126 | 126 | ```html
|
127 | 127 | <transition-group tag="ul" name="slide">
|
|
131 | 131 | </transition-group>
|
132 | 132 | ```
|
133 | 133 |
|
134 |
| -- **See also:** [List Transitions](/guide/transitions-list.html) |
| 134 | +- **Ver também:** [Lista de Transições](/guide/transitions-list.html) |
135 | 135 |
|
136 | 136 | ## keep-alive
|
137 | 137 |
|
138 |
| -- **Props:** |
| 138 | +- **Propriedades:** |
139 | 139 |
|
140 |
| - - `include` - `string | RegExp | Array`. Only components with matching names will be cached. |
141 |
| - - `exclude` - `string | RegExp | Array`. Any component with a matching name will not be cached. |
142 |
| - - `max` - `number | string`. The maximum number of component instances to cache. |
| 140 | + - `include` - `string | RegExp | Array`. Apenas os componentes com nomes correspondentes serão colocados em cache. |
| 141 | + - `exclude` - `string | RegExp | Array`. Qualquer componente com o nome correspondente não será colocado em cache. |
| 142 | + - `max` - `number | string`. O número máximo de instâncias do componente a serem colocadas em cache. |
143 | 143 |
|
144 |
| -- **Usage:** |
| 144 | +- **Uso:** |
145 | 145 |
|
146 |
| - When wrapped around a dynamic component, `<keep-alive>` caches the inactive component instances without destroying them. Similar to `<transition>`, `<keep-alive>` is an abstract component: it doesn't render a DOM element itself, and doesn't show up in the component parent chain. |
| 146 | + Quando *wrapped* (envolvido) em torno de um componente dinâmico, `<keep-alive>` coloca as instâncias dos componentes inativos em cache sem os destruir. Semelhante a `<transition>`, `<keep-alive>` é um componente abstrato: ele não renderiza um elemento DOM em si, e não aparece na cadeia pai do componente. |
147 | 147 |
|
148 |
| - When a component is toggled inside `<keep-alive>`, its `activated` and `deactivated` lifecycle hooks will be invoked accordingly. |
| 148 | + Quando um componente é alternado dentro de `<keep-alive>`, seus gatilhos de ciclo de vida `activated` e` deactivated` serão invocados de acordo. |
149 | 149 |
|
150 |
| - Primarily used to preserve component state or avoid re-rendering. |
| 150 | + Usado principalmente para preservar o estado do componente ou evitar re-renderização. |
151 | 151 |
|
152 | 152 | ```html
|
153 |
| - <!-- basic --> |
| 153 | + <!-- básico --> |
154 | 154 | <keep-alive>
|
155 | 155 | <component :is="view"></component>
|
156 | 156 | </keep-alive>
|
157 | 157 |
|
158 |
| - <!-- multiple conditional children --> |
| 158 | + <!-- filhos com multiplas condições --> |
159 | 159 | <keep-alive>
|
160 | 160 | <comp-a v-if="a > 1"></comp-a>
|
161 | 161 | <comp-b v-else></comp-b>
|
162 | 162 | </keep-alive>
|
163 | 163 |
|
164 |
| - <!-- used together with `<transition>` --> |
| 164 | + <!-- usado juntamente com `<transition>` --> |
165 | 165 | <transition>
|
166 | 166 | <keep-alive>
|
167 | 167 | <component :is="view"></component>
|
168 | 168 | </keep-alive>
|
169 | 169 | </transition>
|
170 | 170 | ```
|
171 | 171 |
|
172 |
| - Note, `<keep-alive>` is designed for the case where it has one direct child component that is being toggled. It does not work if you have `v-for` inside it. When there are multiple conditional children, as above, `<keep-alive>` requires that only one child is rendered at a time. |
| 172 | + Note que, `<keep-alive>` é projetado para o caso em que ele possui um componente filho direto que está sendo alternado. Isso não funciona se você tiver `v-for` dentro dele. Quando há múltiplos filhos condicionais, como acima, `<keep-alive>` exige que apenas um filho seja renderizado de cada vez. |
173 | 173 |
|
174 |
| -- **`include` and `exclude`** |
| 174 | +- **`include` e `exclude`** |
175 | 175 |
|
176 |
| - The `include` and `exclude` props allow components to be conditionally cached. Both props can be a comma-delimited string, a RegExp or an Array: |
| 176 | + As propriedades `include` e `exclude` permitem que os componentes sejam cacheados condicionalmente. Ambas as propriedades podem ser uma String separada por vígulas, uma RegExp ou um Array: |
177 | 177 |
|
178 | 178 | ```html
|
179 |
| - <!-- comma-delimited string --> |
| 179 | + <!-- string separada por vírgulas --> |
180 | 180 | <keep-alive include="a,b">
|
181 | 181 | <component :is="view"></component>
|
182 | 182 | </keep-alive>
|
183 | 183 |
|
184 |
| - <!-- regex (use `v-bind`) --> |
| 184 | + <!-- regex (usando `v-bind`) --> |
185 | 185 | <keep-alive :include="/a|b/">
|
186 | 186 | <component :is="view"></component>
|
187 | 187 | </keep-alive>
|
188 | 188 |
|
189 |
| - <!-- Array (use `v-bind`) --> |
| 189 | + <!-- Array (usando `v-bind`) --> |
190 | 190 | <keep-alive :include="['a', 'b']">
|
191 | 191 | <component :is="view"></component>
|
192 | 192 | </keep-alive>
|
193 | 193 | ```
|
194 | 194 |
|
195 |
| - The match is first checked on the component's own `name` option, then its local registration name (the key in the parent's `components` option) if the `name` option is not available. Anonymous components cannot be matched against. |
| 195 | + A correspondência é verificada primeiro na opção `name` do componente, depois pelo nome no registro local (a chave dentro da opção `components` do pai) se a opção `name` não estiver disponível. Os componentes anônimos não poder ser comparados. |
196 | 196 |
|
197 | 197 | - **`max`**
|
198 | 198 |
|
199 |
| - The maximum number of component instances to cache. Once this number is reached, the cached component instance that was least recently accessed will be destroyed before creating a new instance. |
| 199 | + O número máximo de instâncias do componente a serem guardadas em cache. Quando esse número for atingido, a instância do componente em cache que foi acessada menos recentemente será destruída antes de criar uma nova instância. |
200 | 200 |
|
201 | 201 | ```html
|
202 | 202 | <keep-alive :max="10">
|
203 | 203 | <component :is="view"></component>
|
204 | 204 | </keep-alive>
|
205 | 205 | ```
|
206 | 206 |
|
207 |
| - ::: warning |
208 |
| - `<keep-alive>` does not work with functional components because they do not have instances to be cached. |
| 207 | + ::: warning Aviso |
| 208 | + `<keep-alive>` não funciona com componentes funcionais porque eles não têm instâncias a serem guardadas em cache. |
209 | 209 | :::
|
210 | 210 |
|
211 |
| -- **See also:** [Dynamic Components - keep-alive](../guide/component-dynamic-async.html#dynamic-components-with-keep-alive) |
| 211 | +- **Ver também:** [Componentes dinâmicos - keep-alive](../guide/component-dynamic-async.html#componentes-dinamicos-com-keep-alive) |
212 | 212 |
|
213 | 213 | ## slot
|
214 | 214 |
|
215 |
| -- **Props:** |
| 215 | +- **Propriedades:** |
216 | 216 |
|
217 |
| - - `name` - `string`, Used for named slot. |
| 217 | + - `name` - `string`, Usado para o *slot* nomeado. |
218 | 218 |
|
219 |
| -- **Usage:** |
| 219 | +- **Uso:** |
220 | 220 |
|
221 |
| - `<slot>` serve as content distribution outlets in component templates. `<slot>` itself will be replaced. |
| 221 | + `<slot>` servem como pontos de distribuição de conteúdo em _templates_ de componentes. O `<slot>` em si será substituído. |
222 | 222 |
|
223 |
| - For detailed usage, see the guide section linked below. |
| 223 | + Para obter detalhes sobre o uso, consulte a seção do guia no link abaixo. |
224 | 224 |
|
225 |
| -- **See also:** [Content Distribution with Slots](../guide/component-basics.html#content-distribution-with-slots) |
| 225 | +- **Ver também:** [Distribuição de Conteúdo com Slots](../guide/component-basics.html#distribuicao-de-conteudo-com-slots) |
226 | 226 |
|
227 | 227 | ## teleport
|
228 | 228 |
|
229 |
| -- **Props:** |
| 229 | +- **Propriedades:** |
230 | 230 |
|
231 |
| - - `to` - `string`. Required prop, has to be a valid query selector, or an HTMLElement (if used in a browser environment). Specifies a target element where `<teleport>` content will be moved |
| 231 | + - `to` - `string`. Propriedade obrigatória, tem que ser um seletor (*query*) válido, ou um elemento HTML (*HTMLElement*) (se usado no ambiente do navegador). Especifica um elemento de destino para onde o conteúdo de `<teleport>` será movido. |
232 | 232 |
|
233 | 233 | ```html
|
234 | 234 | <!-- ok -->
|
235 | 235 | <teleport to="#some-id" />
|
236 | 236 | <teleport to=".some-class" />
|
237 | 237 | <teleport to="[data-teleport]" />
|
238 | 238 |
|
239 |
| - <!-- Wrong --> |
| 239 | + <!-- Errado --> |
240 | 240 | <teleport to="h1" />
|
241 | 241 | <teleport to="some-string" />
|
242 | 242 | ```
|
243 | 243 |
|
244 |
| - - `disabled` - `boolean`. This optional prop can be used to disable the `<teleport>`'s functionality, which means that its slot content will not be moved anywhere and instead be rendered where you specified the `<teleport>` in the surrounding parent component. |
| 244 | + - `disabled` - `boolean`. Esta propriedade opcional pode ser usada para desativar a funcionalidade de `<teleport>`, o que significa que o conteúdo do slot não será movido para qualquer lugar, e em vez disso será renderizado onde você especificou o `<teleport>` no componente pai que o envolve. |
245 | 245 |
|
246 | 246 | ```html
|
247 | 247 | <teleport to="#popup" :disabled="displayVideoInline">
|
248 | 248 | <video src="./my-movie.mp4">
|
249 | 249 | </teleport>
|
250 | 250 | ```
|
251 | 251 |
|
252 |
| - Notice that this will move the actual DOM nodes instead of being destroyed and recreated, and it will keep any component instances alive as well. All stateful HTML elements (i.e. a playing video) will keep their state. |
| 252 | + Observe que isso moverá os nós DOM reais em vez de serem destruídos e recriados e também manterá todas as instâncias do componente vivas. Todos os elementos HTML com estado (por exemplo, um vídeo em reprodução) manterão seu estado. |
253 | 253 |
|
254 |
| -- **See also:** [Teleport component](../guide/teleport.html#teleport) |
| 254 | +- **Ver também:** [Componente de teletransporte](../guide/teleport.html#teleporte) |
0 commit comments