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
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 routes from 'vue-auto-routing'
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
export default new Router({
routes
})
You also need to add a webpack plugin vue-auto-routing provides. The plugin options are the same as vue-route-generator options
const VueAutoRoutingPlugin = require('vue-auto-routing/lib/webpack-plugin')
module.exports = {
plugins: [
new VueAutoRoutingPlugin({
pages: 'src/pages',
importPrefix: '@/pages/'
})
]
}
Related Projects
License
MIT