Need help with vue-auto-routing?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

ktsn
228 Stars 19 Forks MIT License 366 Commits 19 Opened issues

Description

Generate Vue Router routing automatically

Services available

!
?

Need anything else?

Contributors list

# 2,143
Vue.js
JavaScr...
vuex
TypeScr...
32 commits
# 604,362
JavaScr...
vue-rou...
vue-cli...
vuejs
2 commits

vue-auto-routing

Generate Vue Router routing automatically.

You may want to use vue-cli-plugin-auto-routing which includes all useful features on routing.

Installation

$ npm install -D vue-auto-routing

Requirements

  • webpack >= v4.0.0

Usage

vue-auto-routing resolves Vue Router routing automatically by using vue-route-generator. The routes are generated with the same rules with Nuxt routing.

To use this, you import

vue-auto-routing
and pass it into Vue Router constructor options.
// Import generated routes
import routes from 'vue-auto-routing'

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

Vue.use(Router)

export default new Router({ // Pass the generated routes into the routes option routes })

You also need to add a webpack plugin vue-auto-routing provides. The plugin options are the same as vue-route-generator options

// webpack.config.js

const VueAutoRoutingPlugin = require('vue-auto-routing/lib/webpack-plugin')

module.exports = { // ... other options ...

plugins: [ new VueAutoRoutingPlugin({ // Path to the directory that contains your page components. pages: 'src/pages',

  // A string that will be added to importing component path (default @/pages/).
  importPrefix: '@/pages/'
})

] }

Related Projects

License

MIT

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.