@nuxtjs/router-module
Nuxt module to use router.js instead of pages/ directory
Last updated 3 years ago by atinux .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @nuxtjs/router-module 
SYNC missed versions from official npm registry.

Nuxt Router Module

npm (scoped with tag) npm CircleCI Codecov Dependencies

js-standard-style

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

???? Release Notes

Features

The module features

Setup

  • Add @nuxtjs/router-module dependency using yarn or npm to your project
  • Add @nuxtjs/router-module to modules section of nuxt.config.js
{
  modules: [
    // Simple usage
    '@nuxtjs/router-module',

    // With options
    ['@nuxtjs/router-module', { /* module options */ }],
 ]
}

Usage

This module disable the pages/ directory into Nuxt and will use a router.js file at your srcDir directory:

components/
  my-page.vue
router.js

router.js need to export a createRouter method like this:

import Vue from 'vue'
import Router from 'vue-router'

import MyPage from '~/components/my-page'

Vue.use(Router)

export function createRouter() {
  return new Router({
    mode: 'history',
    routes: [
      {
        path: '/',
        component: MyPage
      }
    ]
  })
}

License

MIT License

Copyright (c) Sebastien Chopin seb@chopin.io

Current Tags

  • 1.0.0                                ...           latest (3 years ago)

1 Versions

  • 1.0.0                                ...           3 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |