mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
update example
This commit is contained in:
parent
9d59a2f80f
commit
cc15926340
@ -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>
|
||||
|
@ -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: {
|
||||
|
19
examples/custom-routes/pages/author.vue
Normal file
19
examples/custom-routes/pages/author.vue
Normal 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>
|
@ -1,5 +1,8 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<h2>Home</h2>
|
||||
<h1>Home</h1>
|
||||
<h2>
|
||||
Examples of custom routes
|
||||
</h2>
|
||||
</div>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue
Block a user