Skip to content

Commit

Permalink
Merge pull request #2 from vuejs-br/master
Browse files Browse the repository at this point in the history
Sync with head
  • Loading branch information
gab0gomes committed Oct 14, 2020
2 parents 035051c + c039c8c commit 1a60d49
Show file tree
Hide file tree
Showing 30 changed files with 9,415 additions and 343 deletions.
85 changes: 68 additions & 17 deletions src/.vuepress/components/common/codepen-snippet.vue
Original file line number Diff line number Diff line change
@@ -1,48 +1,99 @@
<template>
<p class="codepen" data-height="300" data-theme-id="39028" data-default-tab="result" data-preview="true" data-editable="true"
:data-user="user.slug"
:data-slug-hash="slug"
:data-pen-title="title">
<span>Veja o exemplo <a :href="`https://codepen.io/${user.slug}/pen/${slug}`">
{{ title }}</a> por {{ user.name }} (<a :href="`https://codepen.io/${user.slug}`">@${user.slug}</a>)
no <a href="https://codepen.io">CodePen</a>.</span>
<p
class="codepen"
:data-theme-id="theme"
:data-preview="preview || null"
:data-editable="editable || null"
:data-height="height"
:data-default-tab="tab"
:data-user="user"
:data-slug-hash="slug"
:data-pen-title="title"
:data-embed-version="version"
:style="`height: ${height}px`">
<span>See the Pen <a :href="href">{{ title }}</a>
by {{ name || user }} (<a :href="`https://codepen.io/${user}`">@{{user}}</a>)
on <a href="https://codepen.io">CodePen</a>.</span>
</p>
</template>

<script>
export default {
props: {
user: {
type: Object,
default: () => ({
slug: 'vuejs-br',
name: 'Vue.js Brasil'
}),
},
title: {
type: String,
default: null,
required: true,
},
slug: {
type: String,
default: null,
required: true,
},
tab: {
type: String,
default: 'result',
},
team: {
type: Boolean,
default: true,
},
user: {
type: String,
default: 'Vue',
},
name: {
type: String,
default: null,
},
height: {
type: Number,
default: 300,
},
theme: {
type: String,
default: '39028',
},
preview: {
type: Boolean,
default: true,
},
editable: {
type: Boolean,
default: true,
},
version: {
type: String,
default: null,
}
},
mounted() {
const codepenScript = document.createElement('script')
codepenScript.setAttribute('src', 'https://static.codepen.io/assets/embed/ei.js')
codepenScript.async = true
this.$el.appendChild(codepenScript)
}
},
computed: {
href() {
return `https://codepen.io/${this.team ? 'team' : ''}${this.user}/pen/${this.slug}`
}
},
}
</script>

<style lang="scss">
.codepen {
box-sizing: border-box;
height: 300px;
display: flex;
align-items: center;
justify-content: center;
Expand Down
1 change: 1 addition & 0 deletions src/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const sidebar = {
'/guide/introduction',
'/guide/instance',
'/guide/template-syntax',
'/guide/data-methods',
'/guide/computed',
'/guide/class-and-style',
'/guide/conditional',
Expand Down
55 changes: 55 additions & 0 deletions src/api/composition-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,58 @@ const foo = inject<string>('foo') // string | undefined
- **See also**:
- [Provide / Inject](../guide/component-provide-inject.html)
- [Composition API Provide / Inject](../guide/composition-api-provide-inject.html)

## `getCurrentInstance`

`getCurrentInstance` enables access to an internal component instance useful for advanced usages or for library creators.

```ts
import { getCurrentIntance } from 'vue'
const MyComponent = {
setup() {
const internalIntance = getCurrentInstance()
internalInstance.appContext.config.globalProperties // access to globalProperties
}
}
```

`getCurrentInstance` **only** works during [setup](#setup) or [Lifecycle Hooks](#lifecycle-hooks)

> When using outside of [setup](#setup) or [Lifecycle Hooks](#lifecycle-hooks), please call `getCurrentInstance()` on `setup` and use the instance instead.

```ts
const MyComponent = {
setup() {
const internalIntance = getCurrentInstance() // works
const id = useComponentId() // works
const handleClick = () => {
getCurrentInstance() // doesn't work
useComponentId() // doesn't work
internalIntance // works
}
onMounted(() => {
getCurrentInstance() // works
})
return () =>
h(
'button',
{
onClick: handleClick
},
`uid: ${id}`
)
}
}
// also works if called on a composable
function useComponentId() {
return getCurrentInstance().uid
}
```
2 changes: 1 addition & 1 deletion src/api/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
<!-- shorthand -->
<button @click="doThis"></button>

<!-- shorthand dynamic event (2.6.0+) -->
<!-- shorthand dynamic event -->
<button @[event]="doThis"></button>

<!-- stop propagation -->
Expand Down
4 changes: 3 additions & 1 deletion src/api/instance-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@
If you still want to call an unwatch function inside the callback, you should check its availability first:

```js
const unwatch = vm.$watch(
let unwatch = null

unwatch = vm.$watch(
'value',
function() {
doSomething()
Expand Down
2 changes: 1 addition & 1 deletion src/api/options-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

- **Details:**

Computed properties to be mixed into the Vcomponent instance. All getters and setters have their `this` context automatically bound to the component instance.
Computed properties to be mixed into the component instance. All getters and setters have their `this` context automatically bound to the component instance.

Note that if you use an arrow function with a computed property, `this` won't be the component's instance, but you can still access the instance as the function's first argument:

Expand Down
90 changes: 45 additions & 45 deletions src/coc/index.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
# Code Of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, political party, or sexual identity and orientation. Note, however, that religion, political party, or other ideological affiliation provide no exemptions for the behavior we outline as unacceptable in this Code of Conduct.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at community@vuejs.org. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org
# Código de Conduta

## Nosso Compromisso

No interesse de promover um ambiente aberto e acolhedor, nós, como colaboradores e mantenedores, comprometemo-nos à tornar a participação em nosso projeto e em nossa comunidade uma experiência livre de assédio para todos, independentemente de idade, tamanho corporal, deficiência, etnia, características sexuais, identidade e expressão de gênero, nível de experiência, educação, status socioeconômico, nacionalidade, aparência pessoal, raça, religião, partido político ou identidade e orientação sexual. Note, no entanto, que a religião, partido político ou outra afiliação ideológica não oferecem isenções para o comportamento que delineamos como inaceitável neste Código de Conduta.

## Nossos Padrões

Exemplos de comportamento que contribuem para criar um ambiente positivo incluem:

- Uso de linguagem acolhedora e inclusiva
- Ser respeitoso com pontos de vista e experiências diferentes
- Aceitando graciosamente críticas construtivas
- Focando no que é melhor para a comunidade
- Mostrando empatia para com outros membros da comunidade

Exemplos de comportamento inaceitável pelos participantes incluem:

- O uso de linguagem ou imagens sexualizadas e atenção ou avanços sexuais indesejados
- Insultos ou comentários depreciativos e ataques pessoais ou políticos
- Assédio público ou privado
- Publicar informações privadas de outras pessoas, como endereço físico ou eletrônico, sem permissão explícita
- Outros comportamentos que possam razoavelmente ser considerados inadequados num ambiente profissional

## Nossas Responsabilidades

Os mantenedores do projeto são responsáveis por esclarecer os padrões de comportamento aceitável e devem tomar medidas corretivas apropriadas e justas em resposta a quaisquer casos de comportamento inaceitável.

Os mantenedores do projeto têm o direito e a responsabilidade de remover, editar ou rejeitar comentários, _commits_, códigos, edições na _wiki_, _issues_ e outras contribuições que não estejam alinhadas à este Código de Conduta, ou banir temporariamente ou permanentemente qualquer colaborador por outros comportamentos que julguem inapropriado, ameaçador, ofensivo ou prejudicial.

## Escopo

Este Código de Conduta se aplica tanto dentro como fora dos espaços públicos quando um indivíduo está representando o projeto ou sua comunidade. Exemplos de representação de um projeto ou comunidade incluem o uso de um endereço de e-mail oficial do projeto, postagem por meio de uma conta oficial de mídia social ou a atuação como representante nomeado em um evento on-line ou off-line. A representação de um projeto pode ser definida e esclarecida pelos mantenedores do projeto.

## Execução

Casos de comportamento abusivo, assediador ou inaceitável podem ser relatados entrando em contato com a equipe do projeto em community@vuejs.org (em inglês). Todas as reclamações serão analisadas e investigadas e resultarão em uma resposta considerada necessária e apropriada às circunstâncias. A equipe do projeto é obrigada a manter a confidencialidade em relação ao relator de um incidente. Mais detalhes sobre políticas de execução específicas podem ser publicados separadamente.

Os mantenedores do projeto que não seguem ou aplicam o Código de Conduta de boa fé podem enfrentar repercussões temporárias ou permanentes, conforme determinado por outros membros da liderança do projeto.

## Atribuição

Este Código de Conduta é adaptado do [Acordo do Colaborador][homepage], versão 1.4, disponível em https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org
Loading

0 comments on commit 1a60d49

Please sign in to comment.