vue-autoroute-webpack-plugin

1.0.1 • Public • Published

安装

  npm install vue-autoroute-webpack-plugin --save-dev

使用方法在vue.config.js

  const InitRouterPlugin = require("vue-autoroute-webpack-plugin");
  module.exports = {
    configureWebpack: {
      plugins: [new InitRouterPlugin()]
    }
  };

路由特点

  1. 如果有 @/layouts/index.vue说明希望有唯一的根容器,则会生成 这种格式
export default [
  {
    path: "/",
    name: "index",
    component: () =>
      import(/* webpackChunkName: "index" */ "@/layouts/index.vue"),
    children:[
      // ...
    ]
  }
]
  1. 如果views下局部文件夹有layout.vue,则生成嵌套路由

  2. 如果views下局部文件夹没有layout.vue,则拍平路由 目前多层嵌套,拍平有问题,先支持一层嵌套

  3. 约定式路由约定

  • 动态参数路由 - _id.vue 代表 /:id
  • 不生成到路由表 - -id.vue 则不在routes数组
  • 支持在vue文件中的data设置redirect和meta对象

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.11latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.11

Package Sidebar

Install

npm i vue-autoroute-webpack-plugin

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

15.9 kB

Total Files

6

Last publish

Collaborators

  • randyho