Skip to content

Traduction de components-props.md #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 3, 2018
Merged

Traduction de components-props.md #155

merged 3 commits into from
Sep 3, 2018

Conversation

MachinisteWeb
Copy link
Member

On s'attaque aux props parce qu'on à un peu de temps ! Vos corrections orthographique sons les bienvenues comme toujours !

Signed-off-by: Haeresis <[email protected]>
type: guide
order: 102
---

> This page assumes you've already read the [Components Basics](components.html). Read that first if you are new to components.
> Cette page suppose que vous avez déjà lu les principes de base des [composants](components.html). Lisez [cette partie](components.html) en premier si les composants sont quelque chose de nouveau pour vous.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lisez-les en premier ...

Non ?


<p>Cette page est en cours de traduction. Pour nous aider, vous pouvez participer sur <a href="https://github.com/vuejs-fr/vuejs.org" target="_blank">le dépôt GitHub dédié de Vuejs-FR</a>.</p><p>HTML attribute names are case-insensitive, so browsers will interpret any uppercase characters as lowercase. That means when you're using in-DOM templates, camelCased prop names need to use their kebab-cased (hyphen-delimited) equivalents:</p>
Les noms d'attributs HTML sont insensibles à la casse, aussi les navigateurs interpréteront de la même manière les majuscules et les minuscules. Cela signifie que pour l'utilisation des templates directement dans le DOM les props en camelCase doivent utiliser leur équivalent kebab-case (délimités par des tirets) :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peut-être une virgule entre le DOM et les props ?
Pour laisser souffler le lecteur 😛

Copy link
Member

@Kocal Kocal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bon taf, quelques petites remarques pour ma part ^^

Sinon pas mal le inheritAttrs, je connaissais pas

```

You've also seen props assigned dynamically with `v-bind`, such as in:
vous avez également vu qu'il était possible d'affecter des props dynamiquement avec `v-bind` comme ceci :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vous avez également

@@ -232,7 +232,7 @@ The `type` can be one of the following native constructors:
- Function
- Symbol

In addition, `type` can also be a custom constructor function and the assertion will be made with an `instanceof` check. For example, given the following constructor function exists:
En plus, `type` peut aussi être une fonction constructeur personnalisée et l'assertion pourra être testée avec `instanceof`. Par exemple, avec la fonction constructeur existante suivante :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

De plus


For example, imagine we're using a 3rd-party `bootstrap-date-input` component with a Bootstrap plugin that requires a `data-date-picker` attribute on the `input`. We can add this attribute to our component instance:
Par exemple, imaginez que vous utilisiez un composant tiers `bootstrap-date-input` avec un plugin Bootstrap qui nécessite un `data-date-picker` attribut sul l'`input`. Nous pouvons ajouter cet attribut à notre instance de composant :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attribut sur l'input


<p>Cette page est en cours de traduction. Pour nous aider, vous pouvez participer sur <a href="https://github.com/vuejs-fr/vuejs.org" target="_blank">le dépôt GitHub dédié de Vuejs-FR</a>.</p><p>HTML attribute names are case-insensitive, so browsers will interpret any uppercase characters as lowercase. That means when you're using in-DOM templates, camelCased prop names need to use their kebab-cased (hyphen-delimited) equivalents:</p>
Les noms d'attributs HTML sont insensibles à la casse, aussi les navigateurs interpréteront de la même manière les majuscules et les minuscules. Cela signifie que pour l'utilisation des templates directement dans le DOM les props en camelCase doivent utiliser leur équivalent kebab-case (délimités par des tirets) :
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "interprèteront" en graphie rectifiée


In addition, every time the parent component is updated, all props in the child component will be refreshed with the latest value. This means you should **not** attempt to mutate a prop inside a child component. If you do, Vue will warn you in the console.
De plus, chaque fois que le composant parent est mis à jour, toutes les props du composant enfant vont être mises à jour avec les dernières valeurs. Cela signifie que vous ne devriez **pas** essayer du muter une prop depuis l'intérieur d'un composant. Si vous le faite, Vue lancera un avertissement dans la console.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "Si vous le faites,"


There are usually two cases where it's tempting to mutate a prop:
Il y a couramment deux cas où vous seriez tenter de muter une prop :
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "tenté"

@@ -170,58 +170,58 @@ There are usually two cases where it's tempting to mutate a prop:
}
```

<p class="tip">Note that objects and arrays in JavaScript are passed by reference, so if the prop is an array or object, mutating the object or array itself inside the child component **will** affect parent state.</p>
<p class="tip">Notez que les objets et les tableaux en JavaScript sont passés par référence, ce qui signifie que si la prop est un objet ou un tableau, muter l'objet ou le tableu lui-même dans l'enfant **va** affecter l'état du parent.</p>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "ou le tableau"


Components can specify requirements for its props, such as the types you've already seen. If a requirement isn't met, Vue will warn you in the browser's JavaScript console. This is especially useful when developing a component that's intended to be used by others.
Les composants peuvent spécifier des conditions requises pour leurs props, comme les types que nous avons déjà vu. Si les conditions requises ne sont pas validées, Vue va vous en avertir dans la console JavaScript du navigateur. Cela est particulièrement utile quand on développe un composant destiné à être utilisé par les autres.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "déjà vus."


For most attributes, the value provided to the component will replace the value set by the component. So for example, passing `type="text"` will replace `type="date"` and probably break it! Fortunately, the `class` and `style` attributes are a little smarter, so both values are merged, making the final value: `form-control date-picker-theme-dark`.
Pour la plupard des attributs, la valeur fournie par le composant va remplacé la valeur définie par le composant. Aussi par exemple, passer `type="text"` va remplacer `type="date"` et probablement tout casser ! Heureusement, les attributs `class` et `style` sont plus malins. Ces deux valeurs sont fusionnées, fournissant la valeur finale `form-control date-picker-theme-dark`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "Pour la plupart des attributs, la valeur fournie par le composant va remplacer la valeur définie par le composant."

@@ -302,7 +302,7 @@ Vue.component('my-component', {
})
```

This can be especially useful in combination with the `$attrs` instance property, which contains the attribute names and values passed to a component, such as:
Cela est particulièrement utile avec l'utilisation combinée de la propriété d'instance `$attrs` qui contient les noms et valeurs passées à un composant comme ceci :
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • "passés"

Signed-off-by: Haeresis <[email protected]>
@MachinisteWeb
Copy link
Member Author

Merci à vous deux @Kocal et @rspt !

@Kocal
Copy link
Member

Kocal commented Aug 30, 2018

Seems nice to me 🎉

@MachinisteWeb MachinisteWeb merged commit 1d1458b into master Sep 3, 2018
@MachinisteWeb MachinisteWeb deleted the components-props branch September 3, 2018 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants