-
Notifications
You must be signed in to change notification settings - Fork 1
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
Traduction getters.md
#9
Conversation
Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh bien, tu es chaud ce matin ^^
Pas grand chose à review par contre.
docs/en/getters.md
Outdated
|
||
Vuex allows us to define "getters" in the store (think of them as computed properties for stores). Getters will receive the state as their 1st argument: | ||
Vuex nous permet de définir des "getters" dans le store (voyez-les comme les computed properties des store). Les getters prennent le state en premier argument : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
des stores
Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mes retours sur getters.md
docs/en/getters.md
Outdated
|
||
Sometimes we may need to compute derived state based on store state, for example filtering through a list of items and counting them: | ||
Parfois nous avons besoin de calculer des valeurs basées sur le state du store, par exemple pour filtrer une liste d'éléments et les compter : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l'état
docs/en/getters.md
Outdated
@@ -10,9 +10,9 @@ computed: { | |||
} | |||
``` | |||
|
|||
If more than one component needs to make use of this, we have to either duplicate the function, or extract it into a shared helper and import it in multiple places - both are less than ideal. | |||
Si plus d'un composant a besoin d'utiliser cela, il nous faut ou bien dupliquer cette fonction, ou bien l'extraire dans un helper séparé et l'importer aux endroits nécessaires — les deux idées sont loin d'être idéales. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l'extraire dans une fonction utilitaire séparée
nécessaires. Les deux
docs/en/getters.md
Outdated
|
||
Vuex allows us to define "getters" in the store (think of them as computed properties for stores). Getters will receive the state as their 1st argument: | ||
Vuex nous permet de définir des "getters" dans le store (voyez-les comme les computed properties des store). Les getters prennent le state en premier argument : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
des accesseurs (« getters »)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
voyez-les comme les propriétés calculées des stores
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Les accesseurs prennent l'état
docs/en/getters.md
Outdated
@@ -30,13 +30,13 @@ const store = new Vuex.Store({ | |||
}) | |||
``` | |||
|
|||
The getters will be exposed on the `store.getters` object: | |||
Les getters seront exposé sur l'objet `store.getters` : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Les accesseurs seront exposés
docs/en/getters.md
Outdated
|
||
``` js | ||
store.getters.doneTodos // -> [{ id: 1, text: '...', done: true }] | ||
``` | ||
|
||
Getters will also receive other getters as the 2nd argument: | ||
Les getters recevront également les autres getters en second argument : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Les accesseurs
les autres accesseurs
docs/en/getters.md
Outdated
@@ -75,18 +76,17 @@ getters: { | |||
store.getters.getTodoById(2) // -> { id: 2, text: '...', done: false } | |||
``` | |||
|
|||
### Le helper `mapGetters` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
La fonction utilitaire mapGetters
docs/en/getters.md
Outdated
### The `mapGetters` Helper | ||
|
||
The `mapGetters` helper simply maps store getters to local computed properties: | ||
Le helper `mapGetters` attache simplement vos getters du store aux computed properties locales : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L'utilitaire
mapGetters
vos accesseurs du store
propriétés calculées locales
docs/en/getters.md
Outdated
|
||
``` js | ||
import { mapGetters } from 'vuex' | ||
|
||
export default { | ||
// ... | ||
computed: { | ||
// mix the getters into computed with object spread operator | ||
// rajouter les getters dans computed avec l'object spread operator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
les accesseurs dans
computed
avec l'opérateur de décomposition
docs/en/getters.md
Outdated
@@ -96,11 +96,11 @@ export default { | |||
} | |||
``` | |||
|
|||
If you want to map a getter to a different name, use an object: | |||
Si vous voulez attacher un getter avec un nom différent, utilisez un objet : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
un accesseur
docs/en/getters.md
Outdated
...mapGetters({ | ||
// map this.doneCount to store.getters.doneTodosCount | ||
mapGetters({ | ||
// attacher this.doneCount à store.getters.doneTodosCount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.doneCount
à store.getters.doneTodosCount
Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
Signed-off-by: Bruno Lesieur <bruno.lesieur@gmail.com>
On continue avec les accesseurs !