Skip to content

Commit 7638407

Browse files
authored
Merge pull request #16 from vuejs-fr/form
Relecture de `forms.md`
2 parents c7d2caf + 81afea1 commit 7638407

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

docs/en/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
- [Structure d'une application](structure.md)
1919
- [Plugins](plugins.md)
2020
- [Strict Mode](strict.md)
21-
- [Formulaires](forms.md)
21+
- [Gestion des formulaires](forms.md)
2222
- [Tests](testing.md)
2323
- [Hot Reloading](hot-reload.md)
2424
- [Documentation API](api.md)

docs/en/forms.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Form Handling
1+
# Gestion des formulaires
22

3-
When using Vuex in strict mode, it could be a bit tricky to use `v-model` on a piece of state that belongs to Vuex:
3+
Lorsque l'on utilise Vuex en mode strict, il peut être compliqué d'utiliser `v-model` sur une partie de l'état qui appartient à Vuex :
44

55
``` html
66
<input v-model="obj.message">
77
```
88

9-
Assuming `obj` is a computed property that returns an Object from the store, the `v-model` here will attempt to directly mutate `obj.message` when the user types in the input. In strict mode, this will result in an error because the mutation is not performed inside an explicit Vuex mutation handler.
9+
Supposons que `obj` est une propriété calculée qui retourne un objet depuis le store, le `v-model` tentera de muter directement `obj.message` lorsque l'utilisateur saisit du texte dans le champ. En mode strict, cela produira une erreur car la mutation n'est pas effectuée dans un gestionnaire de mutation Vuex explicite.
1010

11-
The "Vuex way" to deal with it is binding the `<input>`'s value and call an action on the `input` or `change` event:
11+
La « méthode Vuex » pour gérer ça est de lier la valeur de l'`input` et d'appeler une action sur l'évènement `input` ou `change` :
1212

1313
``` html
1414
<input :value="message" @input="updateMessage">
@@ -27,7 +27,7 @@ methods: {
2727
}
2828
```
2929

30-
And here's the mutation handler:
30+
Et voici le gestionnaire de mutation :
3131

3232
``` js
3333
// ...
@@ -38,9 +38,9 @@ mutations: {
3838
}
3939
```
4040

41-
### Two-way Computed Property
41+
### Propriété calculée bidirectionnelle
4242

43-
Admittedly, the above is quite a bit more verbose than `v-model` + local state, and we lose some of the useful features from `v-model` as well. An alternative approach is using a two-way computed property with a setter:
43+
Admettons tout de même que l'exemple ci-dessus est plus verbeux que le `v-model` couplé à l'état local (tout en perdant quelques fonctionnalités pratiques de `v-model` au passage). Une approche alternative consiste à utiliser une propriété calculée bidirectionnelle avec un mutateur :
4444

4545
``` html
4646
<input v-model="message">
@@ -58,4 +58,3 @@ computed: {
5858
}
5959
}
6060
```
61-

0 commit comments

Comments
 (0)