forked from vuejs/vue-router
-
Notifications
You must be signed in to change notification settings - Fork 2
Traduction de essentials/getting-started.md
#4
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
MachinisteWeb
merged 6 commits into
vuejs-fr:working
from
Kocal:essentials/getting-started.md
May 18, 2017
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
019352b
Add fr translations for `essentials/getting-started.md`
Kocal 704cd2a
fixes
Kocal 09cb779
Merge branch 'working' into essentials/getting-started.md
Kocal f9690d0
Merge branch 'working' into essentials/getting-started.md
Kocal 02c5dac
Modifications suite à la review de @Haeresis
Kocal f646694
Modifications suite à la 2ème review de @Haeresis
Kocal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# Getting Started (En) <br><br> *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/vue-router).* | ||
# Pour commencer | ||
|
||
> We will be using [ES2015](https://github.com/lukehoban/es6features) in the code samples in the guide. | ||
> Nous utiliserons [ES2015](https://github.com/lukehoban/es6features) dans les exemples de code dans ce guide. | ||
|
||
Creating a Single-page Application with Vue.js + vue-router is dead simple. With Vue.js, we are already composing our application with components. When adding vue-router to the mix, all we need to do is map our components to the routes and let vue-router know where to render them. Here's a basic example: | ||
Créer une application monopage avec Vue.js + vue-router est vraiment simple. Avec Vue.js, nous concevons déjà notre application avec des composants. En ajoutant vue-router dans notre application, tout ce qu'il nous reste à faire est de relier nos composants aux routes, et de laisser vue-router faire le rendu. Voici un exemple de base : | ||
|
||
> All examples will be using the full version of Vue to make template parsing possible. See more details [here](https://vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only). | ||
> Tous les exemples utiliseront la version complète de Vue pour rendre l'analyse de template possible. Plus de détails [ici](https://fr.vuejs.org/guide/installation.html#Runtime-Compiler-vs-Runtime-seul). | ||
|
||
### HTML | ||
|
||
|
@@ -13,57 +13,57 @@ Creating a Single-page Application with Vue.js + vue-router is dead simple. With | |
<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script> | ||
|
||
<div id="app"> | ||
<h1>Hello App!</h1> | ||
<h1>Bonjour l'application !</h1> | ||
<p> | ||
<!-- use router-link component for navigation. --> | ||
<!-- specify the link by passing the `to` prop. --> | ||
<!-- <router-link> will be rendered as an `<a>` tag by default --> | ||
<router-link to="/foo">Go to Foo</router-link> | ||
<router-link to="/bar">Go to Bar</router-link> | ||
<!-- utilisez le composant `router-link` pour la navigation. --> | ||
<!-- spécifiez le lien en le passant à la prop `to` --> | ||
<!-- <router-link> sera rendu en tag `<a>` par défaut --> | ||
<router-link to="/foo">Aller à Foo</router-link> | ||
<router-link to="/bar">Aller à Bar</router-link> | ||
</p> | ||
<!-- route outlet --> | ||
<!-- component matched by the route will render here --> | ||
<!-- balise pour le composant router-view --> | ||
<!-- le composant correspondant à la route sera rendu ici --> | ||
<router-view></router-view> | ||
</div> | ||
``` | ||
|
||
### JavaScript | ||
|
||
``` js | ||
// 0. If using a module system (e.g. via vue-cli), import Vue and VueRouter and then call Vue.use(VueRouter). | ||
// 0. Si vous utilisez un système de module (ex : via vue-cli), il faut importer Vue et VueRouter et ensuite appeler Vue.use(VueRouter). | ||
|
||
// 1. Define route components. | ||
// These can be imported from other files | ||
// 1. Définissez les composants de route. | ||
// Ces derniers peuvent être importés depuis d'autre fichier | ||
const Foo = { template: '<div>foo</div>' } | ||
const Bar = { template: '<div>bar</div>' } | ||
|
||
// 2. Define some routes | ||
// Each route should map to a component. The "component" can | ||
// either be an actual component constructor created via | ||
// Vue.extend(), or just a component options object. | ||
// We'll talk about nested routes later. | ||
// 2. Définissez des routes. | ||
// Chaque route doit correspondre à un composant. Le « composant » peut | ||
// soit être un véritable composant créé via `Vue.extend()`, ou juste un | ||
// objet d'options. | ||
// Nous parlerons plus tard des routes imbriquées. | ||
const routes = [ | ||
{ path: '/foo', component: Foo }, | ||
{ path: '/bar', component: Bar } | ||
] | ||
|
||
// 3. Create the router instance and pass the `routes` option | ||
// You can pass in additional options here, but let's | ||
// keep it simple for now. | ||
// 3. Créez l'instance du routeur et passez l'option `routes`. | ||
// Vous pouvez également passer des options supplémentaires, | ||
// mais nous allons faire simple pour l'instant. | ||
const router = new VueRouter({ | ||
routes // short for routes: routes | ||
routes // raccourci pour `routes: routes` | ||
}) | ||
|
||
// 4. Create and mount the root instance. | ||
// Make sure to inject the router with the router option to make the | ||
// whole app router-aware. | ||
// 5. Créez et montez l'instance de Vue. | ||
// Soyez sûr d'injecter le routeur avec l'option `router` pour | ||
// permettre à l'application tout entière d'être à l'écoute du routeur. | ||
const app = new Vue({ | ||
router | ||
}).$mount('#app') | ||
|
||
// Now the app has started! | ||
// L'application est maintenant en marche ! | ||
``` | ||
|
||
You can also checkout this example [live](http://jsfiddle.net/yyx990803/xgrjzsup/). | ||
Vous pouvez aussi regarder cet [exemple](http://jsfiddle.net/yyx990803/xgrjzsup/). | ||
|
||
Notice that a `<router-link>` automatically gets the `.router-link-active` class when its target route is matched. You can learn more about it in its [API reference](../api/router-link.md). | ||
Notez qu'un `<router-link>` obtiendra automatiquement la classe `.router-link-active` lorsque sa route cible correspond avec la route actuelle. Vous pouvez en apprendre plus à propos de cela dans sa [documentation d'API](../api/router-link.md). | ||
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.
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.