update example

This commit is contained in:
Alexandre Chopin 2016-12-12 00:15:13 +01:00
parent 9d59a2f80f
commit cc15926340
4 changed files with 50 additions and 16 deletions

View File

@ -1,10 +1,14 @@
<template>
<nuxt-container>
<nav class="Navbar clearfix">
<h1 class="Navbar__Title">Nuxt Custom Routes</h1>
<h1 class="Navbar__Title">
<router-link to="/" class="Navbar__Links__Item__Link">
Nuxt Custom Routes
</router-link>
</h1>
<ul class="Navbar__Links">
<li class="Navbar__Links__Item">
<router-link to="/" class="Navbar__Links__Item__Link">
<router-link to="/author" class="Navbar__Links__Item__Link">
Basic route
</router-link>
</li>

View File

@ -1,17 +1,25 @@
module.exports = {
// router: {
// routes: {
// users: {
// _id: {
// regexp: ':id(\\d+)',
// alias: '/author/:authorid/post/:id'
// // generate: [1, 2, 3, 4] // Need to be finished on generate
// },
// meta: {
// title: 'users'
// },
// alias: '/author/:authorid/post'
// }
router: {
routes: {
author: {
alias: '/nuxt'
},
users: {
_id: {
regexp: ':id(\\d+)'
// generate: [1, 2, 3, 4] // Need to be finished on generate
}
},
posts: {
alias: '/articles'
}
}
},
// generate: {
// routeParams: {
// '/guide/:slug': _(require('./static/docs/guide/menu.json')).values().flatten().map('to').compact().map((slug) => { return { slug: slug.replace(/^\//, '') } }).value(),
// '/api/:slug': _(require('./static/docs/api/menu.json')).values().flatten().map('to').compact().map((slug) => { return { slug: slug.replace(/^\//, '') } }).value(),
// '/examples/:slug': _(require('./static/docs/examples/menu.json')).values().flatten().map('to').compact().map((slug) => { return { slug: slug.replace(/^\//, '') } }).value()
// }
// },
build: {

View File

@ -0,0 +1,19 @@
<template>
<div class="container">
<h1>Basic route with Alias</h1>
<router-link to="/nuxt" class="Navbar__Links__Item__Link" v-if="$route.path === '/author'">
This route is also available on /nuxt
</router-link>
<router-link to="/author" class="Navbar__Links__Item__Link" v-else>
This route is also available on /author
</router-link>
</div>
</template>
<style scoped>
.container
{
text-align: center;
padding-bottom: 30px;
}
</style>

View File

@ -1,5 +1,8 @@
<template>
<div class="container">
<h2>Home</h2>
<h1>Home</h1>
<h2>
Examples of custom routes
</h2>
</div>
</template>