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
-**BREAKING**: `data`component option declaration no longer accepts a plain JavaScript `object` and expects a `function` declaration.
11
+
-**BREAKING**: A declaração da opção `data`do componente não aceita mais um `objeto`JavaScript e espera uma declaração de `função`.
12
12
13
-
-**BREAKING**: when merging multiple `data`return values from mixins or extends, the merge is now shallow instead of deep (only root-level properties are merged).
13
+
-**BREAKING**: Quando mesclando múltiplos valores de retorno do `data`de _mixins_ ou _extends_, a mescla agora é superficial e não profunda (apenas propriedades de nível raiz são mescladas).
14
14
15
-
## 2.x Syntax
15
+
## Sintaxe v2.x
16
16
17
-
In 2.x, developers could define the `data`option with either an `object` or a `function`.
17
+
Na v2.x, os desenvolvedores poderiam definir a opção `data`como um `objeto` ou uma `função`.
18
18
19
-
For example:
19
+
Por exemplo:
20
20
21
21
```html
22
-
<!--Object Declaration-->
22
+
<!--Declaração como Objeto-->
23
23
<script>
24
24
constapp=newVue({
25
25
data: {
@@ -28,7 +28,7 @@ For example:
28
28
})
29
29
</script>
30
30
31
-
<!--Function Declaration-->
31
+
<!--Declaração como Função-->
32
32
<script>
33
33
constapp=newVue({
34
34
data() {
@@ -40,13 +40,13 @@ For example:
40
40
</script>
41
41
```
42
42
43
-
Though this provided some convenience in terms of root instances having a shared state, this has led to confusion due to the fact that its only possible on the root instance.
43
+
Apesar de fornecer algumas conveniências em termos de instâncias raiz possuirem um estado compartilhado, isso gerou confusão devido ao fato de que só é possível na instância raiz.
44
44
45
-
## 3.x Update
45
+
## Atualização v3.x
46
46
47
-
In 3.x, the `data`option has been standardized to only accept a `function` that returns an `object`.
47
+
Na v3.x, a opção `data`foi padronizada para somente receber uma `função` que retorna um `objeto`.
48
48
49
-
Using the example above, there would only be one possible implementation of the code:
49
+
Usando o exemplo acima, haveria apenas uma implementação possível do código:
50
50
51
51
```html
52
52
<script>
@@ -62,9 +62,9 @@ Using the example above, there would only be one possible implementation of the
62
62
</script>
63
63
```
64
64
65
-
## Mixin Merge Behavior Change
65
+
## Mudança de Comportamento na Mescla de _Mixins_
66
66
67
-
In addition, when `data()`from a component and its mixins or extends base are merged, the merge is now performed *shallowly*:
67
+
Além disso, quando a `data()`de um componente e seus _mixins_ ou _extends_ de base são mesclados, a mescla agora é feita *superficialmente*:
68
68
69
69
```js
70
70
constMixin= {
@@ -90,7 +90,7 @@ const CompA = {
90
90
}
91
91
```
92
92
93
-
In Vue 2.x, the resulting `$data`is:
93
+
No Vue 2.x, a `$data`resultante seria:
94
94
95
95
```json
96
96
{
@@ -101,7 +101,7 @@ In Vue 2.x, the resulting `$data` is:
101
101
}
102
102
```
103
103
104
-
In 3.0, the result will be:
104
+
Na v3.0, o resultado será:
105
105
106
106
```json
107
107
{
@@ -111,11 +111,11 @@ In 3.0, the result will be:
111
111
}
112
112
```
113
113
114
-
## Migration Strategy
114
+
## Estratégias de Migração
115
115
116
-
For users relying on the object declaration, we recommend:
116
+
Para usuários que dependem da declaração em objeto, é recomendado:
117
117
118
-
-Extracting the shared data into an external object and using it as a property in`data`
119
-
-Rewrite references to the shared data to point to a new shared object
118
+
-Extrair os dados compartilhados em um objeto externo e usá-los como propriedade em`data`
119
+
-Reescrever as referências à informação compartilhada apontando para um novo objeto compartilhado
120
120
121
-
For users relying on the deep merge behavior from mixins, we recommend refactoring your code to avoid such reliance altogether, since deep merges from mixins are very implicit and can make the code logic more difficult to understand and debug.
121
+
Para usuários que dependem do comportamento de mesclagem profunda dos _mixins_, é recomendado refatorar seu código para evitar tal dependência completamente, já que mesclagens profundas de _mixins_ são muito implícitas e podem fazer a lógica do código ser mais difícil de entender e depurar.
0 commit comments