add name on custom routes example

This commit is contained in:
Alexandre Chopin 2016-12-07 01:58:59 +01:00
parent b0c308f1b1
commit 3536936856
2 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@ Add your custom routes inside `nuxt.config.js`:
module.exports = { module.exports = {
router: { router: {
routes: [ routes: [
{ path: '/users/:id', component: 'pages/user' } { name: 'user', path: '/users/:id', component: 'pages/user' }
] ]
} }
} }
@ -32,7 +32,7 @@ Let's say I have a component `pages/user.vue` and I don't want nuxt.js to create
You can then change the component path in the `nuxt.config.js`: You can then change the component path in the `nuxt.config.js`:
```js ```js
// ... // ...
{ path: '/users/:id', component: 'pages/_user' } { name: 'user', path: '/users/:id', component: 'pages/_user' }
// ... // ...
``` ```

View File

@ -1,7 +1,7 @@
module.exports = { module.exports = {
router: { router: {
routes: [ routes: [
{ path: '/users/:id(\\d+)', component: 'pages/_user' } { name: 'user', path: '/users/:id(\\d+)', component: 'pages/_user' }
] ]
}, },
build: { build: {