接口初始化 第一版

This commit is contained in:
yuping
2022-11-16 01:28:42 +08:00
parent c2f02a33e5
commit f9ae1c0027
27 changed files with 13054 additions and 550 deletions

View File

@@ -1,16 +1,14 @@
const routes = [];
const context = require.context('@/views', true, /\.vue$/, 'lazy');
context.keys().forEach(path => {
// console.log('path', path)
const context =import.meta.glob("../views/*/*.vue")
Object.keys(context).forEach(path => {
const componentName = path.replace(/.*\/([^\\.\\/]*)\.vue$/, '$1');
routes.push({
path: `/${componentName.toLowerCase()}`,
name: componentName,
component: () => context(path),
component: () => import(path/* @vite-ignore */),
meta: {
isLink: true
}
});
});
export default routes;