Skip to content

Commit 7eef84d

Browse files
authored
Merge pull request #256 from GuiDevloper/fast-translation
Fast translation of a bunch of pages
2 parents 1f646d6 + aae8226 commit 7eef84d

18 files changed

+450
-450
lines changed

src/api/computed-watch-api.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
# Computed and watch
1+
# Dados Computados e Observadores
22

3-
> This section uses [single-file component](../guide/single-file-component.html) syntax for code examples
3+
> Esta seção usa a sintaxe de [Componentes Single-File](../guide/single-file-component.html) para exemplos de código
44
55
## `computed`
66

7-
Takes a getter function and returns an immutable reactive [ref](./refs-api.html#ref) object for the returned value from the getter.
7+
Recebe uma função _getter_ e retorna um objeto [ref](./refs-api.html#ref) reativo imutável para o valor retornado do _getter_.
88

99
```js
1010
const count = ref(1)
1111
const plusOne = computed(() => count.value + 1)
1212

1313
console.log(plusOne.value) // 2
1414

15-
plusOne.value++ // error
15+
plusOne.value++ // erro
1616
```
1717

18-
Alternatively, it can take an object with `get` and `set` functions to create a writable ref object.
18+
Alternativamente, ele pode usar um objeto com as funções `get` e `set` para criar um objeto ref gravável.
1919

2020
```js
2121
const count = ref(1)
@@ -30,16 +30,16 @@ plusOne.value = 1
3030
console.log(count.value) // 0
3131
```
3232

33-
**Typing:**
33+
**Tipando:**
3434

3535
```ts
36-
// read-only
36+
// somente leitura
3737
function computed<T>(
3838
getter: () => T,
3939
debuggerOptions?: DebuggerOptions
4040
): Readonly<Ref<Readonly<T>>>
4141

42-
// writable
42+
// gravável
4343
function computed<T>(
4444
options: {
4545
get: () => T
@@ -63,21 +63,21 @@ interface DebuggerEvent {
6363

6464
## `watchEffect`
6565

66-
Runs a function immediately while reactively tracking its dependencies and re-runs it whenever the dependencies are changed.
66+
Executa uma função imediatamente enquanto rastreia reativamente suas dependências e a executa novamente sempre que as dependências são alteradas.
6767

6868
```js
6969
const count = ref(0)
7070

7171
watchEffect(() => console.log(count.value))
72-
// -> logs 0
72+
// -> loga 0
7373

7474
setTimeout(() => {
7575
count.value++
76-
// -> logs 1
76+
// -> loga 1
7777
}, 100)
7878
```
7979

80-
**Typing:**
80+
**Tipando:**
8181

8282
```ts
8383
function watchEffect(
@@ -103,32 +103,32 @@ type InvalidateCbRegistrator = (invalidate: () => void) => void
103103
type StopHandle = () => void
104104
```
105105
106-
**See also**: [`watchEffect` guide](../guide/reactivity-computed-watchers.html#watcheffect)
106+
**Ver também**: [Guia do `watchEffect`](../guide/reactivity-computed-watchers.html#watcheffect)
107107
108108
## `watchPostEffect` <Badge text="3.2+" />
109109
110-
Alias of `watchEffect` with `flush: 'post'` option.
110+
Apelido de `watchEffect` com a opção `flush: 'post'`.
111111
112112
## `watchSyncEffect` <Badge text="3.2+" />
113113
114-
Alias of `watchEffect` with `flush: 'sync'` option.
114+
Apelido de `watchEffect` com a opção `flush: 'sync'`.
115115
116116
## `watch`
117117
118-
The `watch` API is the exact equivalent of the Options API [this.\$watch](./instance-methods.html#watch) (and the corresponding [watch](./options-data.html#watch) option). `watch` requires watching a specific data source and applies side effects in a separate callback function. It also is lazy by default - i.e. the callback is only called when the watched source has changed.
118+
A API do `watch` é o equivalente exato da API de Opções [this.\$watch](./instance-methods.html#watch) (e a opção [watch](./options-data.html#watch) correspondente). `watch` requer a observação de uma fonte de dados específica e aplica efeitos colaterais em uma função _callback_ separada. Também é preguiçoso por padrão - ou seja, o _callback_ só é chamado quando a fonte monitorada é alterada.
119119
120-
- Compared to [watchEffect](#watcheffect), `watch` allows us to:
120+
- Comparado com [watchEffect](#watcheffect), `watch` nos permite:
121121
122-
- Perform the side effect lazily;
123-
- Be more specific about what state should trigger the watcher to re-run;
124-
- Access both the previous and current value of the watched state.
122+
- Executar o efeito colateral preguiçosamente;
123+
- Ser mais específico sobre qual estado deve fazer com que o observador seja executado novamente;
124+
- Acessar o valor anterior e o atual do estado observado.
125125
126-
### Watching a Single Source
126+
### Observando uma Única Fonte
127127
128-
A watcher data source can either be a getter function that returns a value, or directly a [ref](./refs-api.html#ref):
128+
A fonte de dados do observador pode ser uma função _getter_ que retorna um valor ou diretamente um [ref](./refs-api.html#ref):
129129
130130
```js
131-
// watching a getter
131+
// observando um getter
132132
const state = reactive({ count: 0 })
133133
watch(
134134
() => state.count,
@@ -137,31 +137,31 @@ watch(
137137
}
138138
)
139139

140-
// directly watching a ref
140+
// observando diretamente uma ref
141141
const count = ref(0)
142142
watch(count, (count, prevCount) => {
143143
/* ... */
144144
})
145145
```
146146

147-
### Watching Multiple Sources
147+
### Observando Várias Fontes
148148

149-
A watcher can also watch multiple sources at the same time using an array:
149+
Um observador também pode observar várias fontes ao mesmo tempo usando um array:
150150

151151
```js
152152
watch([fooRef, barRef], ([foo, bar], [prevFoo, prevBar]) => {
153153
/* ... */
154154
})
155155
```
156156

157-
### Shared Behavior with `watchEffect`
157+
### Comportamento Compartilhado com `watchEffect`
158158

159-
`watch` shares behavior with [`watchEffect`](#watcheffect) in terms of [manual stoppage](../guide/reactivity-computed-watchers.html#stopping-the-watcher), [side effect invalidation](../guide/reactivity-computed-watchers.html#side-effect-invalidation) (with `onInvalidate` passed to the callback as the 3rd argument instead), [flush timing](../guide/reactivity-computed-watchers.html#effect-flush-timing) and [debugging](../guide/reactivity-computed-watchers.html#watcher-debugging).
159+
`watch` compartilha comportamento com [`watchEffect`](#watcheffect) em termos de [interrupção manual](../guide/reactivity-computed-watchers.html#parando-o-observador), [invalidação de efeito colateral](../guide/reactivity-computed-watchers.html#invalidacao-de-efeito-colateral) (com `onInvalidate` passado para o _callback_ como o terceiro argumento), [momento de limpeza](../guide/reactivity-computed-watchers.html#momento-de-limpeza-do-efeito) e [depuração](../guide/reactivity-computed-watchers.html#depuracao-do-observador).
160160

161-
**Typing:**
161+
**Tipando:**
162162

163163
```ts
164-
// watching single source
164+
// observando uma única fonte
165165
function watch<T>(
166166
source: WatcherSource<T>,
167167
callback: (
@@ -172,7 +172,7 @@ function watch<T>(
172172
options?: WatchOptions
173173
): StopHandle
174174

175-
// watching multiple sources
175+
// observando várias fontes
176176
function watch<T extends WatcherSource<unknown>[]>(
177177
sources: T
178178
callback: (
@@ -189,11 +189,11 @@ type MapSources<T> = {
189189
[K in keyof T]: T[K] extends WatcherSource<infer V> ? V : never
190190
}
191191

192-
// see `watchEffect` typing for shared options
192+
// veja a tipagem de `watchEffect` para opções compartilhadas
193193
interface WatchOptions extends WatchEffectOptions {
194194
immediate?: boolean // default: false
195195
deep?: boolean
196196
}
197197
```
198198

199-
**See also**: [`watch` guide](../guide/reactivity-computed-watchers.html#watch)
199+
**Ver também**: [Guia do `watch`](../guide/reactivity-computed-watchers.html#watch)

0 commit comments

Comments
 (0)