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/cookbook/automatic-global-registration-of-base-components.md
+15-15Lines changed: 15 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
# Automatic Global Registration of Base Components
1
+
# Registro Global Automático de Componentes Base
2
2
3
-
## Base Example
3
+
## Exemplo Básico
4
4
5
-
Many of your components will be relatively generic, possibly only wrapping an element like an input or a button. We sometimes refer to these as [base components](../style-guide/#base-component-names-strongly-recommended) and they tend to be used very frequently across your components.
5
+
Muitos de seus componentes serão relativamente genéricos, possivelmente envolvendo apenas um elemento como um _input_ ou um botão. Às vezes, nos referimos a eles como [componentes base](../style-guide/#nomes-de-componentes-base-fortemente-recomendado) e eles tendem a ser usados com muita frequência em seus componentes.
6
6
7
-
The result is that many components may include long lists of base components:
7
+
O resultado é que muitos componentes podem incluir longas listas de componentes base:
8
8
9
9
```js
10
10
importBaseButtonfrom'./BaseButton.vue'
@@ -19,7 +19,7 @@ export default {
19
19
}
20
20
```
21
21
22
-
Just to support relatively little markup in a template:
22
+
Apenas para suportar relativamente pouca marcação em um _template_:
@@ -28,7 +28,7 @@ Just to support relatively little markup in a template:
28
28
</BaseButton>
29
29
```
30
30
31
-
Fortunately, if you're using webpack (or[Vue CLI](https://github.com/vuejs/vue-cli), which uses webpack internally), you can use`require.context`to globally register only these very common base components. Here's an example of the code you might use to globally import base components in your app's entry file (e.g.`src/main.js`):
31
+
Felizmente, se você estiver usando webpack (ou[Vue CLI](https://github.com/vuejs/vue-cli), que usa webpack internamente), você pode usar`require.context`para registrar globalmente apenas esses componentes base comuns. Aqui está um exemplo do código que você pode usar para importar globalmente componentes base no arquivo de entrada do seu aplicativo (ex.:`src/main.js`):
32
32
33
33
```js
34
34
import { createApp } from'vue'
@@ -39,22 +39,22 @@ import App from './App.vue'
39
39
constapp=createApp(App)
40
40
41
41
constrequireComponent=require.context(
42
-
//The relative path of the components folder
42
+
//O caminho relativo da pasta de componentes
43
43
'./components',
44
-
//Whether or not to look in subfolders
44
+
//Se deve ou não procurar nas subpastas
45
45
false,
46
-
//The regular expression used to match base component filenames
46
+
//Expressão regular para encontrar nomes de arquivos de componente base
47
47
/Base[A-Z]\w+\.(vue|js)$/
48
48
)
49
49
50
50
requireComponent.keys().forEach(fileName=> {
51
-
//Get component config
51
+
//Obtém a configuração do componente
52
52
constcomponentConfig=requireComponent(fileName)
53
53
54
-
//Get PascalCase name of component
54
+
//Obtém o nome do componente em PascalCase
55
55
constcomponentName=upperFirst(
56
56
camelCase(
57
-
//Gets the file name regardless of folder depth
57
+
//Obtém o nome do arquivo independente da profundidade da pasta
Every application reaches a point where it's necessary to understand failures, small to large. In this recipe, we explore a few workflows for VS Code users who would like to debug their applications in the browser.
3
+
Todo aplicativo chega a um ponto em que é necessário entender falhas, de pequenas a grandes. Nesta receita, exploramos alguns fluxos de trabalho para usuários do VS Code que desejam depurar seus aplicativos no navegador.
4
4
5
-
This recipe shows how to debug[Vue CLI](https://github.com/vuejs/vue-cli)applications in VS Code as they run in the browser.
5
+
Esta receita mostra como depurar aplicativos[Vue CLI](https://github.com/vuejs/vue-cli)no VS Code à medida que são executados no navegador.
6
6
7
-
## Prerequisites
7
+
## Pré-requisitos
8
8
9
-
Make sure you have VS Code and the browser of your choice installed.
9
+
Certifique-se de ter o VS Code e o navegador de sua escolha instalados.
10
10
11
-
Install and create a project with the[vue-cli](https://github.com/vuejs/vue-cli), following the instructions in the [Vue CLI Guide](https://cli.vuejs.org/). Change into the newly created application directory and open VS Code.
11
+
Instale e crie um projeto com o[vue-cli](https://github.com/vuejs/vue-cli), seguindo as instruções do [Guia do Vue CLI](https://cli.vuejs.org/). Mude para o diretório do aplicativo recém-criado e abra o VS Code.
12
12
13
-
### Displaying Source Code in the Browser
13
+
### Exibindo o Código-fonte no Navegador
14
14
15
-
Before you can debug your Vue components from VS Code, you need to update the generated Webpack config to build sourcemaps. We do this so that our debugger has a way to map the code within a compressed file back to its position in the original file. This ensures that you can debug an application even after your assets have been optimized by Webpack.
15
+
Antes que possa depurar seus componentes Vue a partir do VS Code, você precisa atualizar a configuração do Webpack gerada para construir _sourcemaps_. Fazemos isso para que nosso depurador tenha uma maneira de mapear o código dentro de um arquivo compactado de volta à sua posição no arquivo original. Isso garante que você possa depurar um aplicativo mesmo depois que seus ativos tiverem sido otimizados pelo Webpack.
16
16
17
-
If you use Vue CLI 2, set or update the `devtool`property inside`config/index.js`:
17
+
Se você usa Vue CLI 2, defina ou atualize a propriedade `devtool`dentro de`config/index.js`:
18
18
19
19
```json
20
20
devtool: 'source-map',
21
21
```
22
22
23
-
If you use Vue CLI 3, set or update the `devtool`property inside`vue.config.js`:
23
+
Se você usa Vue CLI 3, defina ou atualize a propriedade `devtool`dentro de`vue.config.js`:
24
24
25
25
```js
26
-
module.exports= {
26
+
modulo.exports= {
27
27
configureWebpack: {
28
28
devtool:'source-map',
29
29
},
30
30
}
31
31
```
32
32
33
-
### Launching the Application from VS Code
33
+
### Iniciando o Aplicativo a partir do VS Code
34
34
35
35
::: info
36
-
We're assuming the port to be`8080`here. If it's not the case (for instance, if`8080`has been taken and Vue CLI automatically picks another port for you), just modify the configuration accordingly.
36
+
Estamos assumindo que a porta é`8080`aqui. Se não for o caso (por exemplo, se`8080`foi usado e Vue CLI automaticamente escolhe outra porta para você), apenas modifique a configuração de acordo.
37
37
:::
38
38
39
-
Click on the Debugging icon in the Activity Bar to bring up the Debug view, then click on the gear icon to configure a launch.json file, selecting**Chrome/Firefox: Launch**as the environment. Replace content of the generated launch.json with the corresponding configuration:
39
+
Clique no ícone "Debugging" na Barra de Atividade para abrir a _view_ de Depuração e, em seguida, clique no ícone de engrenagem para configurar um arquivo launch.json, selecionando**Chrome/Firefox: Launch**como ambiente. Substitua o conteúdo do launch.json gerado pela configuração correspondente:
<divstyle="padding: 10px25px30px"><imgsrc="/images/breakpoint_set.png"alt="Renderização de Ponto de Interrupção"style="width: 690px; border-radius: 3px; box-shadow: 010px15pxrgb(000 / 50%)"></div>
75
75
76
76
77
-
2. Open your favorite terminal at the root folder and serve the app using Vue CLI:
77
+
2.Abra seu terminal favorito na pasta raiz e sirva o aplicativo usando Vue CLI:
78
78
79
79
```
80
80
npm run serve
81
81
```
82
82
83
-
3. Go to the Debug view, select the **'vuejs: chrome/firefox'**configuration, then press F5 or click the green play button.
83
+
3.Vá para a _view_ de Depuração, selecione a configuração **'vuejs: chrome/firefox'**e pressione F5 ou clique no botão verde _play_.
84
84
85
-
4. Your breakpoint should now be hit as a new browser instance opens`http://localhost:8080`.
85
+
4.Seu ponto de interrupção agora deve ser atingido quando uma nova instância do navegador abrir`http://localhost:8080`.
<divstyle="padding: 10px25px30px"><imgsrc="/images/breakpoint_hit.png"alt="Atingindo Ponto de Interrupção"style="width: 690px; border-radius: 3px; box-shadow: 010px15pxrgb(000 / 50%)"></div>
88
88
89
-
## Alternative Patterns
89
+
## Padrões Alternativos
90
90
91
91
### Vue Devtools
92
92
93
-
There are other methods of debugging, varying in complexity. The most popular and simple of which is to use the excellent Vue.js devtools [for Chrome](https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd)and [for Firefox](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/). Some of the benefits of working with the devtools are that they enable you to live-edit data properties and see the changes reflected immediately. The other major benefit is the ability to do time travel debugging for Vuex.
93
+
Existem outros métodos de depuração, variando em complexidade. O mais popular e simples é usar as excelentes devtools do Vue.js [para Chrome](https://chrome.google.com/webstore/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd)e [para Firefox](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/). Alguns dos benefícios de trabalhar com as devtools são que elas permitem que você edite propriedades de dados ao vivo e veja as alterações refletidas imediatamente. O outro grande benefício é a capacidade de fazer depuração _time travel_ para Vuex.

96
96
97
-
Please note that if the page uses a production/minified build of Vue.js (such as the standard link from a CDN), devtools inspection is disabled by default so the Vue pane won't show up. If you switch to an unminified version, you may have to give the page a hard refresh to see them.
97
+
Por favor, note que se a página usa uma produção/compilação minificada do Vue.js (como o link padrão de um CDN), a inspeção devtools é desabilitada por padrão para que o painel Vue não apareça. Se você mudar para uma versão não minificada, talvez seja necessário atualizar a página para vê-los.
98
98
99
-
### Simple Debugger Statement
99
+
### Simples Instrução _Debugger_
100
100
101
-
The example above has a great workflow. However, there is an alternative option where you can use the [native debugger statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger)directly in your code. If you choose to work this way, it's important that you remember to remove the statements when you're done.
101
+
O exemplo acima tem um ótimo fluxo de trabalho. No entanto, há uma opção alternativa em que você pode usar a [instrução nativa "debugger"](https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Statements/debugger)diretamente em seu código. Se você optar por trabalhar dessa maneira, é importante lembrar de remover as declarações quando terminar.
102
102
103
103
```vue
104
104
<script>
@@ -109,14 +109,14 @@ export default {
109
109
}
110
110
},
111
111
mounted() {
112
-
const hello = 'Hello World!'
112
+
const hello = 'Olá Mundo!'
113
113
debugger
114
114
this.message = hello
115
115
}
116
116
};
117
117
</script>
118
118
```
119
119
120
-
## Acknowledgements
120
+
## Reconhecimentos
121
121
122
-
This recipe was based on a contribution from[Kenneth Auchenberg](https://twitter.com/auchenberg), [available here](https://github.com/Microsoft/VSCode-recipes/tree/master/vuejs-cli).
122
+
Esta receita foi baseada em uma contribuição de[Kenneth Auchenberg](https://twitter.com/auchenberg), [disponível aqui](https://github.com/Microsoft/VSCode-recipes/tree/master/vuejs-cli).
Copy file name to clipboardExpand all lines: src/guide/composition-api-setup.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ setup(props) {
47
47
}
48
48
```
49
49
50
-
If`title`is an optional prop, it could be missing from`props`. In that case, `toRefs`won't create a ref for`title`. Instead you'd need to use`toRef`:
50
+
Se`title`for um prop opcional, ele pode estar faltando em`props`. Nesse caso, `toRefs`não criará uma referência para`title`. Em vez disso, você precisaria usar`toRef`:
0 commit comments