Skip to content

Traduction de named-routes.md #18

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
merged 3 commits into from
Jun 18, 2017
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion docs/fr/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- [Dynamic Route Matching (En)](essentials/dynamic-matching.md)
- [Nested Routes (En)](essentials/nested-routes.md)
- [Programmatic Navigation (En)](essentials/navigation.md)
- [Named Routes (En)](essentials/named-routes.md)
- [Routes nommées](essentials/named-routes.md)
- [Named Views (En)](essentials/named-views.md)
- [Redirect and Alias (En)](essentials/redirect-and-alias.md)
- [Passing Props to Route Components (En)](essentials/passing-props.md)
Expand Down
17 changes: 8 additions & 9 deletions docs/fr/essentials/named-routes.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
# Named Routes (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).*
# Routes nommées

Sometimes it is more convenient to identify a route with a name, especially when linking to a route or performing navigations. You can give a route a name in the `routes` options while creating the Router instance:
Parfois il est plus pratique d'identifer une route avec un nom, tout particulièrement quand on souhaite attacher cette route ou exécuter des actions de navigation. Vous pouvez donner à une route un nom dans les options `routes` pendant la création de l'instance du routeur :
Copy link
Member

Choose a reason for hiding this comment

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

donner un nom à une route


``` js
const router = new VueRouter({
routes: [
{
path: '/user/:userId',
path: '/utilisateur/:userId',
name: 'user',
component: User
}
]
})
```

To link to a named route, you can pass an object to the `router-link`
component's `to` prop:
Pour attacher une route nommée, vous pouvez passer un objet à la prop `to` du composant `router-link` :

``` html
<router-link :to="{ name: 'user', params: { userId: 123 }}">User</router-link>
<router-link :to="{ name: 'user', params: { userId: 123 }}">Utilisateur</router-link>
```

This is the exact same object used programatically with `router.push()`:
C'est exactement le même objet à utiliser programmatiquement avec `router.push()` :

``` js
router.push({ name: 'user', params: { userId: 123 }})
```

In both cases, the router will navigate to the path `/user/123`.
Dans les deux cas, le routeur va naviguer vers le chemin `/utilisateur/123`.

Full example [here](https://github.com/vuejs/vue-router/blob/dev/examples/named-routes/app.js).
Un exemple complet se trouve [ici](https://github.com/vuejs/vue-router/blob/dev/examples/named-routes/app.js).