1.0.1 • Published 3 years ago

vue-autoroute-webpack-plugin v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

安装

  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对象
1.0.1

3 years ago

1.0.0

3 years ago