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: Framework/vue-br.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,12 +122,12 @@ function flushSchedulerQueue() {
122
122
for (index =0; index <queue.length; index++) {
123
123
watcher = queue[index]
124
124
if (watcher.before) {
125
-
watcher.before() //call `beforeUpdate`
125
+
watcher.before() //chama `beforeUpdate`
126
126
}
127
127
id =watcher.id
128
128
has[id] =null
129
129
watcher.run()
130
-
//in dev build, check and stop circular updates.
130
+
//no dev build, verifca e para check and stop circular updates.
131
131
if (process.env.NODE_ENV!=='production'&& has[id] !=null) {
132
132
circular[id] = (circular[id] ||0) +1
133
133
if (circular[id] >MAX_UPDATE_COUNT) {
@@ -157,50 +157,50 @@ function callUpdatedHooks(queue) {
157
157
}
158
158
```
159
159
160
-
There are two lifecycle functions that aren’t mentioned in the above diagram, `activated`and`deactivated`, and only the `kee-alive`component has these two life cycles. Components wrapped with`keep-alive`will not be destroyed during the switch, but be cached in memory and execute the `deactivated` hook function, and execute the `actived`hook function after matching the cache and rendering.
160
+
Existem duas funções do ciclo de vida que não são mencionada no diagrama acima, `activated`e`deactivated`, e apenas o componente `kee-alive`possui esses dois ciclos. Componente encapsulado com`keep-alive`não serão destruídos durante o switch, mas sera cacheado em memória e executado a função gancho `deactivated`, e executar a função `actived`depois de coincidir o cache e a renderização.
161
161
162
-
Finally, let’s see the hook function that used to destroy the component.
162
+
Finalmente, vamos olhar a função gancho usada para destruir o componente.
163
163
164
164
```js
165
165
Vue.prototype.$destroy=function() {
166
166
// ...
167
167
callHook(vm, 'beforeDestroy')
168
168
vm._isBeingDestroyed=true
169
-
// remove self from parent
169
+
// remove se mesmo a partir do pai
170
170
constparent=vm.$parent
171
171
if (parent &&!parent._isBeingDestroyed&&!vm.$options.abstract) {
172
172
remove(parent.$children, vm)
173
173
}
174
-
//teardown watchers
174
+
//destroi watchers
175
175
if (vm._watcher) {
176
176
vm._watcher.teardown()
177
177
}
178
178
let i =vm._watchers.length
179
179
while (i--) {
180
180
vm._watchers[i].teardown()
181
181
}
182
-
// remove reference from data ob
183
-
//frozen object may not have observer.
182
+
// remove a referência a partir do dado ob
183
+
//objeto congelados não devem ter um observador.
184
184
if (vm._data.__ob__) {
185
185
vm._data.__ob__.vmCount--
186
186
}
187
-
//call the last hook...
187
+
//chame o último gancho...
188
188
vm._isDestroyed=true
189
-
// invoke destroy hooks on current rendered tree
190
-
vm.__patch__(vm._vnode, null)
191
-
// fire destroyed hook
189
+
// invoque ganchos destruídos na árvore atualmente renderizada
190
+
// dispare o gancho destruído
192
191
callHook(vm, 'destroyed')
193
-
//turn off all instance listeners.
192
+
//desligo todos os ouvintes da instância.
194
193
vm.$off()
195
194
// remove __vue__ reference
195
+
// remove __vue__ reference
196
196
if (vm.$el) {
197
197
vm.$el.__vue__=null
198
198
}
199
-
//release circular reference (#6759)
199
+
//lance uma referência circular (#6759)
200
200
if (vm.$vnode) {
201
201
vm.$vnode.parent=null
202
202
}
203
203
}
204
204
```
205
205
206
-
The `beforeDestroy`hook function will be called before the destroy operation is performed, and then a series of destruction operations are performed. If there are child components, they will be destroyed recursively, and only when all the child components are destroyed, the hook `destroyed`of the root component will be executed.
206
+
A função `beforeDestroy`será chamada antes da operação de destruir ser desempenhada, e então uma série de operações de destruição são desempenhadas. Se existe um componente filho, eles serão destruidos recursivamente, e apenas quando todos os componente filhos são destruídos, o gancho `destroyed`do componente raíz será executado.
0 commit comments