Skip to content

events.md #27

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

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 60 additions & 60 deletions src/v2/guide/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ type: guide
order: 9
---

## Listening to Events
## Ecoute des événements

Choose a reason for hiding this comment

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

ne pas oublier de traduire le "title" tout en haut du fichier "Gestion des évènements"


<p class="tip">**Cette page est en cours de traduction française. Revenez une autre fois pour lire une traduction achevée ou [participez à la traduction française ici](https://github.com/vuejs-fr/vuejs.org).**</p>We can use the `v-on` directive to listen to DOM events and run some JavaScript when they're triggered.
Nous pouvons utiliser l'instruction `v-on` pour écouter les événements du DOM afin d'éxécuter des scripts Javascript lorsque ces événements surviennent.
Copy link
Member

Choose a reason for hiding this comment

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

JavaScript

Choose a reason for hiding this comment

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

"éxécuter des scripts Javascript" => "exécuter du Javascript"

Copy link
Member

Choose a reason for hiding this comment

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

exécuter du JavaScript


For example:
Par example:
Copy link
Member

Choose a reason for hiding this comment

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

Par exemple :

exemple prend un « e » en français.

un espace en français entre (exemple et « : »).

Choose a reason for hiding this comment

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

example => exemple


``` html
<div id="example-1">
<button v-on:click="counter += 1">Add 1</button>
<p>The button above has been clicked {{ counter }} times.</p>
<p>Le boutton ci-dessus à été cliqué {{ counter }} fois.</p>
Copy link
Member

Choose a reason for hiding this comment

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

bouton

Copy link
Member

Choose a reason for hiding this comment

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

a

(verbe)

</div>
```
``` js
Expand All @@ -25,12 +25,12 @@ var example1 = new Vue({
})
```

Result:
Resultat:
Copy link
Member

Choose a reason for hiding this comment

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

Résultat :


{% raw %}
<div id="example-1" class="demo">
<button v-on:click="counter += 1">Add 1</button>
<p>The button above has been clicked {{ counter }} times.</p>
<p>Le boutton ci-dessus à été cliqué {{ counter }} fois.</p>
Copy link
Member

Choose a reason for hiding this comment

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

bouton

et

à

</div>
<script>
var example1 = new Vue({
Expand All @@ -42,15 +42,15 @@ var example1 = new Vue({
</script>
{% endraw %}

## Method Event Handlers
## Gestionnaire de Méthodes pour "les Evénements"

Choose a reason for hiding this comment

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

Je traduirais plutôt par "Les méthodes de gestion d'évènement"


The logic for many event handlers will be more complex though, so keeping your JavaScript in the value of the `v-on` attribute simply isn't feasible. That's why `v-on` can also accept the name of a method you'd like to call.
La logique pour beaucoup des gestionnaires d'événements sera très certainement plus compliqué, par consequence, garder vos valeurs dans l'attribu `v-on` ne sera pas possible. C'est pour cette raison que `v-on` peut également accepter que vous nommiez vos méthodes comme vous le souhaitez.
Copy link
Member

Choose a reason for hiding this comment

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

attribut

la traduction ne garde pas le sens pour

C'est pour cette raison que v-on peut également accepter le nom de la méthode que vous désirez appeler.

Copy link
Member

@MachinisteWeb MachinisteWeb Feb 7, 2017

Choose a reason for hiding this comment

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

Je laisse @sylvainpolletvillard ou @nyl-auster voir pour la traduction de « Method Event Handlers » et « many event handlers » on peut je suis sur qu'on peut mieux faire.

Choose a reason for hiding this comment

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

"sera cependant plus complexe" à la place de "sera très certainement plus compliqué" (plus proche de l'original je crois)

Choose a reason for hiding this comment

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

"pour beaucoup des" => "pour beaucoup de" ( me semble plus français)

Choose a reason for hiding this comment

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

consequence => conséquence

Choose a reason for hiding this comment

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

De gros contre-sens ici :
"garder vos valeurs dans l'attribu v-on ne sera pas possible" =>
"garder votre javascript dans la valeur de l'attribut v-on ne sera tout simplement pas possible. C'est pourquoi v-on peut aussi accepter le nom d'une méthode que vous voudriez appeler."

Copy link
Member

Choose a reason for hiding this comment

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

JavaScript

Choose a reason for hiding this comment

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

attribu => attribut


For example:
For exemple:
Copy link
Member

Choose a reason for hiding this comment

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

Par exemple :

Choose a reason for hiding this comment

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

For exemple => Par exemple


``` html
<div id="example-2">
<!-- `greet` is the name of a method defined below -->
<!-- `greet` est le nom de la méthode defini ce-dessous-->
Copy link
Member

Choose a reason for hiding this comment

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

définie

Copy link
Member

Choose a reason for hiding this comment

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

ci-dessous

Choose a reason for hiding this comment

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

définie

<button v-on:click="greet">Greet</button>
</div>
```
Expand All @@ -61,28 +61,28 @@ var example2 = new Vue({
data: {
name: 'Vue.js'
},
// define methods under the `methods` object
// defini les méthodes sous l'objet `methods`
Copy link
Member

Choose a reason for hiding this comment

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

défini les méthodes de l'objet

(même si la traduction est littéralement bonne)

Choose a reason for hiding this comment

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

"Définissez les méthodes dans l'objet methods"

methods: {
greet: function (event) {
// `this` inside methods points to the Vue instance
// `this` à l'intérieur de l'objet methods se réfère à l'instance de Vue.
Copy link
Member

Choose a reason for hiding this comment

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

Je proposerai :

this fait référence à l'instance de Vue à l'intérieur de methods.

methods avec les ` comme this.

alert('Hello ' + this.name + '!')
Copy link
Member

Choose a reason for hiding this comment

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

alert('Bonjour ' + this.name + ' !')

// `event` is the native DOM event
// `event` est un événement natif du DOM
Copy link
Member

Choose a reason for hiding this comment

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

l'événement

Choose a reason for hiding this comment

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

est l'évènement natif du DOM

if (event) {
alert(event.target.tagName)
}
}
}
})

// you can invoke methods in JavaScript too
// vous pouvez également invoqué ces méthodes en Javscript
Copy link
Member

Choose a reason for hiding this comment

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

vous pouvez également invoquer ces méthodes en JavaScript

Choose a reason for hiding this comment

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

invoquer

example2.greet() // -> 'Hello Vue.js!'
Copy link
Member

Choose a reason for hiding this comment

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

// -> 'Bonjour Vue.js !'

```

Result:
Resultat:
Copy link
Member

Choose a reason for hiding this comment

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

Résultat :
(accent, espace)

Choose a reason for hiding this comment

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

Résultat (accent)

Copy link
Member

Choose a reason for hiding this comment

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

(espace) avant « : »


{% raw %}
<div id="example-2" class="demo">
<button v-on:click="greet">Greet</button>
<button v-on:click="greet">Salutation</button>

Choose a reason for hiding this comment

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

je traduirais plutôt par "Dire bonjour" ici mais à voir avec les autres

Copy link
Member

Choose a reason for hiding this comment

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

Les deux me vont

</div>
<script>
var example2 = new Vue({
Expand All @@ -92,7 +92,7 @@ var example2 = new Vue({
},
methods: {
greet: function (event) {
alert('Hello ' + this.name + '!')
alert('Bonjour ' + this.name + '!')
Copy link
Member

Choose a reason for hiding this comment

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

' !'
(espace)

Copy link
Member

Choose a reason for hiding this comment

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

alert('Bonjour ' + this.name + ' !')

(espace avant le !)

if (event) {
alert(event.target.tagName)
}
Expand All @@ -102,9 +102,9 @@ var example2 = new Vue({
</script>
{% endraw %}

## Methods in Inline Handlers
## Gestionnaire de Méthodes "En-ligne":
Copy link
Member

Choose a reason for hiding this comment

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

Je propose

Méthode d'écoute(ur) dans les attributs

Choose a reason for hiding this comment

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

Les méthodes dans les gestionnaires "En-ligne"

Copy link
Member

Choose a reason for hiding this comment

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

Pour moi :

Les méthodes dans les attributs

est plus clair et concis, qu'en dite vous ?


Instead of binding directly to a method name, we can also use methods in an inline JavaScript statement:
Au lieu de lier directement la méthode à un nom, nous pouvons également utiliser la méthode avec une declaration Javascript dans la ligne:
Copy link
Member

@MachinisteWeb MachinisteWeb Feb 7, 2017

Choose a reason for hiding this comment

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

Je propose pour se débarrasser du « inline » gênant :

Au lieu de lier directement la méthode par son nom dans l'attribut, nous pouvons également utiliser la méthode avec une instruction JavaScript :

Choose a reason for hiding this comment

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

Contre sens :
"Au lieu de lier directement le nom d'une méthode, nous pouvons aussi utiliser les méthodes dans une déclaration Javascript en ligne"

Copy link
Member

@MachinisteWeb MachinisteWeb Feb 10, 2017

Choose a reason for hiding this comment

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

JavaScript

et

(espace) avant « : »


``` html
<div id="example-3">
Copy link
Member

Choose a reason for hiding this comment

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

<button v-on:click="say('salut')">Dire salut</button>
<button v-on:click="say('quoi')">Dire quoi</button>

Expand Down Expand Up @@ -141,28 +141,28 @@ new Vue({
</script>
Copy link
Member

Choose a reason for hiding this comment

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

<button v-on:click="say('salut')">Dire salut</button>

et

<button v-on:click="say('quoi')">Dire quoi</button>

x2

{% endraw %}

Sometimes we also need to access the original DOM event in an inline statement handler. You can pass it into a method using the special `$event` variable:
Parfois, nous avons également besoin, avec les déclarations en ligne, d'accéder aux événements du DOM. Vous pouvez réaliser ceci en utilisant la variable speciale `$event`:
Copy link
Member

@MachinisteWeb MachinisteWeb Feb 7, 2017

Choose a reason for hiding this comment

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

Je propose

Parfois nous avons également besoin d'accéder à l'événement original du DOM depuis l'instruction dans l'attribut.

(l'emploi des virgules ne se justifie pas vis à vis de la traduction. Moins littéralement, la phrase est assez courte pour s'en passer).

Choose a reason for hiding this comment

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

Parfois nous avons également besoin d'accéder à l'évènement original du DOM au sein d'une déclaration d'un gestionnaire en ligne. Vous pouvez le passer à une méthode en utilisant la variable spéciale $event


``` html
<button v-on:click="warn('Form cannot be submitted yet.', $event)">Submit</button>
<button v-on:click="avertissement('Le formulaire ne peut être soumit pour le moment.', $event)">Soumettre</button>
Copy link
Member

Choose a reason for hiding this comment

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

On conserve warn car c'est une valeur de code.

Choose a reason for hiding this comment

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

soumis

```

``` js
Copy link
Member

Choose a reason for hiding this comment

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

// now we have access to the native event

devient

// maintenant nous avons accès à l'événement natif

// ...
methods: {
warn: function (message, event) {
avertissement: function (message, event) {
Copy link
Member

Choose a reason for hiding this comment

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

On conserve warn

Choose a reason for hiding this comment

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

en effet, remettre "warn"

// now we have access to the native event
if (event) event.preventDefault()
alert(message)
}
}
```

## Event Modifiers
## Modifieurs "Events"
Copy link
Member

@MachinisteWeb MachinisteWeb Feb 7, 2017

Choose a reason for hiding this comment

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

Modificateurs d'événements

Choose a reason for hiding this comment

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

Question @tous ; j'ai traduit modifiers par "modificateurs" , on fait quoi pour ce mot ?

Copy link
Member

@MachinisteWeb MachinisteWeb Feb 10, 2017

Choose a reason for hiding this comment

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

On prend « Modificateur ». J'hésitais dans ma review ici entre « Modifieur » qui n'est pas dans le dico et « Modificateur » qui est à priori la traduction littéral jusqu'à voir ta trad :)


It is a very common need to call `event.preventDefault()` or `event.stopPropagation()` inside event handlers. Although we can do this easily inside methods, it would be better if the methods can be purely about data logic rather than having to deal with DOM event details.
C'est un besoin courant que de faire appel ā `event.preventDefault()` ou `event.stopPropagation()` à l'intérieur d'une déclaration d'événements. Bien que nous puissions realiser ceci aisément à l'intérieur de "Methods", il aurait été préférable que "Methods" reste purement dedié à la logique des données au lieu d'avoir à prendre en charge les éléments du DOM>
Copy link
Member

Choose a reason for hiding this comment

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

réaliser

et

à l'intérieur des méthodes

(ici on parle bien des méthodes déclaré et non de la propriété methods de Vue.

Copy link
Member

Choose a reason for hiding this comment

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

il serait préférable que les méthodes restent purement dédiées

et

prendre en charge les événements du DOM en détails

Choose a reason for hiding this comment

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

"d'une déclaration de gestionnaire d'évènement"
realiser => réaliser
"il aurait été préférable" => il serait préférable


To address this problem, Vue provides **event modifiers** for `v-on`. Recall that modifiers are directive postfixes denoted by a dot.
Pour resoudre ce problème, Vue propose des modifieurs d'événement à `v-on`. Evoquer ces modifieurs se fait grâce aux extensions d'instruction, ceux-ci commençant par un point.
Copy link
Member

@MachinisteWeb MachinisteWeb Feb 7, 2017

Choose a reason for hiding this comment

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

Pour résoudre

modificateurs

pour v-on

Faire appel à ces modificateurs (?)

Choose a reason for hiding this comment

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

modifieurs => modificateur


- `.stop`
- `.prevent`
Expand All @@ -171,87 +171,86 @@ To address this problem, Vue provides **event modifiers** for `v-on`. Recall tha
- `.once`

``` html
<!-- the click event's propagation will be stopped -->
<a v-on:click.stop="doThis"></a>
<!-- la propagation de l'événement du clic sera stoppé -->

Choose a reason for hiding this comment

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

stoppée

<a v-on:click.stop="faisCeci"></a>
Copy link
Member

Choose a reason for hiding this comment

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

doThis (nom de fonction, à ne pas traduire)


<!-- the submit event will no longer reload the page -->
<form v-on:submit.prevent="onSubmit"></form>
<!-- l'événement submit, ne rechargera plus la page -->
Copy link
Member

Choose a reason for hiding this comment

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

« submit »

<form v-on:submit.prevent="Soumettre"></form>
Copy link
Member

Choose a reason for hiding this comment

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

onSubmit

à conserver


<!-- modifiers can be chained -->
<a v-on:click.stop.prevent="doThat"></a>
<!-- les modifieurs peuvent être chainés -->
Copy link
Member

@MachinisteWeb MachinisteWeb Feb 7, 2017

Choose a reason for hiding this comment

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

modificateurs

Choose a reason for hiding this comment

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

modificateurs

<a v-on:click.stop.prevent="faisCela"></a>
Copy link
Member

Choose a reason for hiding this comment

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

doThat

à conserver


<!-- just the modifier -->
<!-- seulement le modifieur -->
Copy link
Member

@MachinisteWeb MachinisteWeb Feb 7, 2017

Choose a reason for hiding this comment

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

modificateur

<form v-on:submit.prevent></form>

<!-- use capture mode when adding the event listener -->
<div v-on:click.capture="doThis">...</div>
<!-- utilise le mode "capture" lorsque l'événement d'écoute est ajouté -->
Copy link
Member

Choose a reason for hiding this comment

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

« capture »

<div v-on:click.capture="faisCeci">...</div>
Copy link
Member

Choose a reason for hiding this comment

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

doThis

à conserver


<!-- only trigger handler if event.target is the element itself -->
<!-- i.e. not from a child element -->
<div v-on:click.self="doThat">...</div>
<!-- seulement déclanché si l'instruction "event.target" est l'élément lui même.-->
Copy link
Member

Choose a reason for hiding this comment

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

seulement déclenché si l'instruction « event.target » est l'élément lui-même.

<!-- note : ne s'applique pas aux éléments "enfant" -->
Copy link
Member

Choose a reason for hiding this comment

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

c-à-d : ne s'applique pas aux éléments enfants

<div v-on:click.self="faisCeci">...</div>
Copy link
Member

Choose a reason for hiding this comment

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

doThat

(à conserver)

```

> New in 2.1.4

``` html
<!-- the click event will be triggered at most once -->
<a v-on:click.once="doThis"></a>
<!-- l'événement "click" sera déclenché au moins une fois -->
Copy link
Member

Choose a reason for hiding this comment

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

« click »

ou

de clic

<a v-on:click.once="faisCeci"></a>
Copy link
Member

Choose a reason for hiding this comment

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

doThis

(à conserver)

Choose a reason for hiding this comment

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

on ne traduit que les commentaires

```

Unlike the other modifiers, which are exclusive to native DOM events, the `.once` modifier can also be used on [component events](components.html#Using-v-on-with-Custom-Events). If you haven't read about components yet, don't worry about this for now.

## Key Modifiers
Au contraire des autres modifieurs, qui sont exclusifs aux événement natif du DOM, le modifieur `.once` peut également être utilisé pour les [component events](components.html#Using-v-on-with-Custom-Events). Si vous n'avez pas encore lu la section concernant les composants, ne vous en inquitez pas pour le moment.
Copy link
Member

@MachinisteWeb MachinisteWeb Feb 7, 2017

Choose a reason for hiding this comment

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

modificateurs

Copy link
Member

@MachinisteWeb MachinisteWeb Feb 7, 2017

Choose a reason for hiding this comment

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

aux événements natifs du DOM

modificateur

événements des composants

Choose a reason for hiding this comment

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

modificateurs
natif => natifs
traduire components events
inquitez => inquiétez


When listening for keyboard events, we often need to check for common key codes. Vue also allows adding key modifiers for `v-on` when listening for key events:
## Modifieurs "key" (Touches)
Lorsque nous écoutons les événements du clavier, nous avons regulièrement besoin de s'assurer des codes des touches. Vue permet également d'ajouter un modifieur de touches pour `v-on`:
Copy link
Member

@MachinisteWeb MachinisteWeb Feb 7, 2017

Choose a reason for hiding this comment

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

modificateur

régulièrement


``` html
<!-- only call vm.submit() when the keyCode is 13 -->
<!-- faire appel à vm.submit() quand le code touche est 13 seulement -->
Copy link
Member

Choose a reason for hiding this comment

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

faire appel à « vm.submit() » uniquement quand le code de la touche est 13

<input v-on:keyup.13="submit">
```

Remembering all the keyCodes is a hassle, so Vue provides aliases for the most commonly used keys:
Rappelez vous que les codes des touches sont disputés, c'est pourquoi Vue propose des alias pour ceux courament employés.
Copy link
Member

Choose a reason for hiding this comment

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

Se rappeler de tous les codes des touches est compliqué, c'est pourquoi Vue propose des alias pour les touches les plus couramment employées :


``` html
<!-- same as above -->
<!-- même exemple que le précédent -->
<input v-on:keyup.enter="submit">

<!-- also works for shorthand -->
<!-- fonctionne également pour les raccourcis -->
<input @keyup.enter="submit">
```

Here's the full list of key modifier aliases:
Voici une liste complète des raccourci clavier "modifieurs"
Copy link
Member

@MachinisteWeb MachinisteWeb Feb 7, 2017

Choose a reason for hiding this comment

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

Voici la liste complète des raccourcis de modifieurs pour les touches :

modificateur


- `.enter`
- `.tab`
- `.delete` (captures both "Delete" and "Backspace" keys)
- `.delete` (fonctionne pour les touches "Suppression" et "retour-arrière")
Copy link
Member

Choose a reason for hiding this comment

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

(fonctionne pour les touches "Suppression" et "Retour arrière")

- `.esc`
- `.space`
- `.up`
- `.down`
- `.left`
- `.right`

You can also [define custom key modifier aliases](../api/#keyCodes) via the global `config.keyCodes` object:
Vous pouvez également [definir des raccourci personnalisé pour vos "modifieurs" ](../api/#keyCodes) grâce à l'objet global `config.keyCodes`:
Copy link
Member

@MachinisteWeb MachinisteWeb Feb 7, 2017

Choose a reason for hiding this comment

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

des raccourcis personnalisés pour vos modificateurs


``` js
// enable v-on:keyup.f1
// active v-on:keyup.f1
Vue.config.keyCodes.f1 = 112
```

## Modifier Keys
## Modifieurs "key" (Touches)
Copy link
Member

@MachinisteWeb MachinisteWeb Feb 7, 2017

Choose a reason for hiding this comment

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

Modificateurs de touches


> New in 2.1.0

You can use the following modifiers to trigger mouse or keyboard event listeners only when the corresponding modifier key is pressed:
Vous pouvez utiliser les modifieurs suivants pour déclancher un événement du clavier ou de la souris seulement lorsque la touche du modifieur est appuyé :
Copy link
Member

@MachinisteWeb MachinisteWeb Feb 7, 2017

Choose a reason for hiding this comment

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

modificateurs

lorsque la touche du modifieur correspondant

modificateurs

appuyée


- `.ctrl`
- `.alt`
- `.shift`
- `.meta`

> Note: On Macintosh keyboards, meta is the command key (⌘). On Windows keyboards, meta is the windows key (⊞). On Sun Microsystems keyboards, meta is marked as a solid diamond (◆). On certain keyboards, specifically MIT and Lisp machine keyboards and successors, such as the Knight keyboard, space-cadet keyboard, meta is labeled “META”. On Symbolics keyboards, meta is labeled “META” or “Meta.
> Note: Sur les claviers Macintosh, meta est la touche commande (⌘). Sur Windows, meta est la touche windows (⊞). Sur les claviers Sun Microsystems, meta est symbolisé par un diamant plein (◆). Sur certain clavier, spécifiquement sur les claviers des machines MIT et Lisp et leurs successeurs, comme le clavier "Knight" et "space-cadet", meta est ecrit "META". Sur les claviers Symboliques, meta est etiqueté "META" ou "Meta".
Copy link
Member

Choose a reason for hiding this comment

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

« Knight » et « space-cadet »

« META » ou « Meta »


For example:
Par exemple:
Copy link
Member

Choose a reason for hiding this comment

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

Par exemple :

(espace)

Copy link
Member

Choose a reason for hiding this comment

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

Par exemple :

(espace avant :)


```html
<!-- Alt + C -->
Expand All @@ -261,12 +260,13 @@ For example:
<div @click.ctrl="doSomething">Do something</div>
```

## Why Listeners in HTML?
## Pourquoi des écoutes dans le code HTML ?
Copy link
Member

Choose a reason for hiding this comment

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

Pourquoi des écouteurs dans le HTML ?


You might be concerned that this whole event listening approach violates the good old rules about "separation of concerns". Rest assured - since all Vue handler functions and expressions are strictly bound to the ViewModel that's handling the current view, it won't cause any maintenance difficulty. In fact, there are several benefits in using `v-on`:
Vous pouriez être preoccupé que tous ces événements d'écoutes viole la bonne vieille règle de la separation des problèmes.
Copy link
Member

@MachinisteWeb MachinisteWeb Feb 7, 2017

Choose a reason for hiding this comment

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

séparation des préoccupations

(je sais, c'est bizarre, mais c'est la traduction la plus courante et validée ici)

Rassurez-vous - depuis que le gestionnaire de fonctions et d'expressions est strictement lié à "ViewModel" qui gère la vue courante, cela ne causera aucune difficulté de maintenance. En realité, il y a plusieurs bénéfices à utiliser `v-on` :
Copy link
Member

Choose a reason for hiding this comment

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

Il ne doit pas y avoir de saut de ligne. Le fichier traduit doit faire le même nombre de ligne.

comme le gestionnaire de fonctions et d'expressions est strictement lié au « ViewModel »

« ViewModel »


1. It's easier to locate the handler function implementations within your JS code by simply skimming the HTML template.
1. Il est plus facile de localiser l'implementation des functions dans le gestionnaire de code JS en survolant le code HTML.
Copy link
Member

Choose a reason for hiding this comment

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

des fonctions


2. Since you don't have to manually attach event listeners in JS, your ViewModel code can be pure logic and DOM-free. This makes it easier to test.
2. Comme vous n'avez pas à attacher manuellement les écoutes dans votre JS, le code du "ViewModel" peut-être purement logique et sans DOM. Ceci rend plus facile les tests.
Copy link
Member

Choose a reason for hiding this comment

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

les écouteurs

Copy link
Member

Choose a reason for hiding this comment

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

« ViewModel »


3. When a ViewModel is destroyed, all event listeners are automatically removed. You don't need to worry about cleaning it up yourself.
3. Quand un "ViewModel est detruit, tout les evenements d'ecoutes sont automatiquenemt retiré". Vous n'aveez pas à vous soucier de le faire vous meme.
Copy link
Member

Choose a reason for hiding this comment

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

« ViewModel »

vous-même