-
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 de structure.md
#10
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
# Application Structure | ||
# Structure d'une application | ||
|
||
Vuex doesn't really restrict how you structure your code. Rather, it enforces a set of high-level principles: | ||
Vuex ne vous restreint pas vraiment dans la façon dont vous voulez structurer votre code. Il impose plutôt un set de principes de haut niveau : | ||
|
||
1. Application-level state is centralized in the store. | ||
1. Le state d'application est centralisé dans le store. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
2. The only way to mutate the state is by committing **mutations**, which are synchronous transactions. | ||
2. La seule façon de muter le state est de commiter des **mutations**, qui sont des transactions synchrones. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
3. Asynchronous logic should be encapsulated in, and can be composed with **actions**. | ||
3. La logique asynchrone doit être composée et encapsulée dans des **actions**. | ||
|
||
As long as you follow these rules, it's up to you how to structure your project. If your store file gets too big, simply start splitting the actions, mutations and getters into separate files. | ||
Tant que vous suivez ces règles, c'est à vous de structurer votre projet. Si votre fichier de store devient trop gros, commencez simplement par séparer les actions, mutations et getters dans des fichiers séparés. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
For any non-trivial app, we will likely need to leverage modules. Here's an example project structure: | ||
Pour une application non-triviale, nous aurons probablement besoin de faire appel à des modules. Voici un exemple de structure de projet : | ||
|
||
``` bash | ||
├── index.html | ||
|
@@ -21,12 +21,12 @@ For any non-trivial app, we will likely need to leverage modules. Here's an exam | |
│ ├── App.vue | ||
│ └── ... | ||
└── store | ||
├── index.js # where we assemble modules and export the store | ||
├── actions.js # root actions | ||
├── mutations.js # root mutations | ||
├── index.js # Là où l'on assemble nos modules et exportons le store | ||
├── actions.js # Actions racine | ||
├── mutations.js # Mutations racine | ||
└── modules | ||
├── cart.js # cart module | ||
└── products.js # products module | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
``` | ||
|
||
As a reference, check out the [Shopping Cart Example](https://github.com/vuejs/vuex/tree/dev/examples/shopping-cart). | ||
Vous pouvez jeter à un œil à [l'exemple Shopping Cart](https://github.com/vuejs/vuex/tree/dev/examples/shopping-cart). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
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.