Name: router-module
Owner: Nuxt Community
Description: Nuxt.js module to use router.js instead of pages/ directory.
Created: 2017-09-07 12:01:00.0
Updated: 2018-05-22 18:02:24.0
Pushed: 2018-05-19 14:18:53.0
Homepage: null
Size: 170
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Nuxt module to use router.js instead of pages/ directory
Use your own router.js
to handle your routes into your Nuxt.js application.
@nuxtjs/router
dependency with yarn
or npm
into your project@nuxtjs/router
to modules
section of nuxt.config.js
:
dules: [
'@nuxtjs/router'
/
route to generate
section of nuxt.config.js
:
nerate: {
routes: [
'/'
]
This module disable the pages/
directory into Nuxt and will use a router.js
file at your srcDir
directory:
onents/
-page.vue
er.js
router.js
need to export a createRouter
method like this:
rt Vue from 'vue'
rt Router from 'vue-router'
rt MyPage from '~/components/my-page'
use(Router)
rt function createRouter() {
turn new Router({
mode: 'history',
routes: [
{
path: '/',
component: MyPage
}
]
Copyright (c) Sebastien Chopin seb@chopin.io