Files
fe-manage/src/router/config.js
2022-11-21 17:48:26 +08:00

26 lines
831 B
JavaScript

/*
* @Author: lixg lixg@dongwu-inc.com
* @Date: 2022-11-09 09:26:26
* @LastEditors: lixg lixg@dongwu-inc.com
* @LastEditTime: 2022-11-21 17:42:50
* @FilePath: /fe-manage/src/router/config.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
const routes = [];
const context = require.context("@/views", true, /\.vue$/, "lazy");
context.keys().forEach((path) => {
// console.log('path', path)
const componentName = path.replace(/.*\/([^\\.\\/]*)\.vue$/, "$1");
routes.push({
path: `/${componentName.toLowerCase()}/:id?`,
name: componentName,
component: () => context(path),
meta: {
isLink: true,
},
});
// console.log('routes', routes)
});
export default routes;