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>
|
<template>
|
||||||
<nuxt-container>
|
<nuxt-container>
|
||||||
<nav class="Navbar clearfix">
|
<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">
|
<ul class="Navbar__Links">
|
||||||
<li class="Navbar__Links__Item">
|
<li class="Navbar__Links__Item">
|
||||||
<router-link to="/" class="Navbar__Links__Item__Link">
|
<router-link to="/author" class="Navbar__Links__Item__Link">
|
||||||
Basic route
|
Basic route
|
||||||
</router-link>
|
</router-link>
|
||||||
</li>
|
</li>
|
||||||
|
@ -1,17 +1,25 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
// router: {
|
router: {
|
||||||
// routes: {
|
routes: {
|
||||||
// users: {
|
author: {
|
||||||
// _id: {
|
alias: '/nuxt'
|
||||||
// regexp: ':id(\\d+)',
|
},
|
||||||
// alias: '/author/:authorid/post/:id'
|
users: {
|
||||||
// // generate: [1, 2, 3, 4] // Need to be finished on generate
|
_id: {
|
||||||
// },
|
regexp: ':id(\\d+)'
|
||||||
// meta: {
|
// generate: [1, 2, 3, 4] // Need to be finished on generate
|
||||||
// title: 'users'
|
}
|
||||||
// },
|
},
|
||||||
// alias: '/author/:authorid/post'
|
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: {
|
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>
|
<template>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h2>Home</h2>
|
<h1>Home</h1>
|
||||||
|
<h2>
|
||||||
|
Examples of custom routes
|
||||||
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
Loading…
Reference in New Issue
Block a user