nuxt-community/router-module

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Nuxt Router Module

npm (scoped with tag) npm CircleCI Codecov

js-standard-style

Nuxt module to use router.js instead of pages/ directory

? Release Notes

Features

Use your own router.js to handle your routes into your Nuxt.js application.

Setup
  1. Install @nuxtjs/router dependency with yarn or npm into your project
  2. Add @nuxtjs/router to modules section of nuxt.config.js:

dules: [
'@nuxtjs/router'


  1. If you are using SPA mode, add an index / route to generate section of nuxt.config.js:

nerate: {
routes: [
  '/'
]


Usage

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
  }
]


License

MIT License

Copyright (c) Sebastien Chopin seb@chopin.io


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.