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: src/guide/migration/events-api.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,15 +3,15 @@ badges:
3
3
- breaking
4
4
---
5
5
6
-
# Events API <MigrationBadges:badges="$frontmatter.badges" />
6
+
# API de eventos <MigrationBadges:badges="$frontmatter.badges" />
7
7
8
-
## Overview
8
+
## Visão geral
9
9
10
-
`$on`, `$off`and`$once`instance methods are removed. Application instances no longer implement the event emitter interface.
10
+
Os métodos `$on`, `$off`e`$once`foram retirados da instancia. A instancia da aplicação não implementa mais a interface de emissor de eventos.
11
11
12
-
## 2.x Syntax
12
+
## 2.x Sintaxe
13
13
14
-
In 2.x, Vue instance could be used to trigger handlers attached imperatively via the event emitter API (`$on`,`$off`and`$once`). This was used to create_event hubs_to create global event listeners used across the whole application:
14
+
Na 2.x, a instância Vue pode ser usada para acionar manipuladores anexados imperativamente por meio da API do emissor de eventos (`$on`,`$off`e`$once`). Isso foi usado para criar_event hubs_para permitir a comunicação de eventos globais usados em todo o aplicativo:
15
15
16
16
```js
17
17
// eventHub.js
@@ -29,7 +29,7 @@ export default {
29
29
mounted() {
30
30
// adding eventHub listener
31
31
eventHub.$on('custom-event', () => {
32
-
console.log('Custom event triggered!')
32
+
console.log('Evento customizado disparado!')
33
33
})
34
34
},
35
35
beforeDestroy() {
@@ -46,18 +46,18 @@ import eventHub from './eventHub'
46
46
exportdefault {
47
47
methods: {
48
48
callGlobalCustomEvent() {
49
-
eventHub.$emit('custom-event') //if ChildComponent is mounted, we will have a message in the console
49
+
eventHub.$emit('custom-event') //Quando o componente ChildComponent é montado, nós teremos uma mensagem no console
50
50
}
51
51
}
52
52
}
53
53
```
54
54
55
-
## 3.x Update
55
+
## 3.x Atualização
56
56
57
-
We removed `$on`,`$off`and`$once`methods from the instance completely. `$emit`is still a part of the existing API as it's used to trigger event handlers declaratively attached by a parent component
57
+
Removemos os métodos `$on`,`$off`e`$once`da instância completamente. `$emit`ainda é uma parte da API existente, pois é usado para acionar manipuladores de eventos declarativamente anexados por um componente pai.
58
58
59
-
## Migration Strategy
59
+
## Estratégia de Migração
60
60
61
-
Existing event hubs can be replaced by using an external library implementing the event emitter interface, for example[mitt](https://github.com/developit/mitt)or[tiny-emitter](https://github.com/scottcorgan/tiny-emitter).
61
+
As comunicações por _event hubs_ existentes podem ser substituídos usando uma biblioteca externa implementando a interface do emissor de eventos, por exemplo[mitt](https://github.com/developit/mitt)ou[tiny-emitter](https://github.com/scottcorgan/tiny-emitter).
62
62
63
-
These methods can also be supported in compatibility builds.
63
+
Esses métodos também podem ser suportados em compilações de compatibilidade.
0 commit comments