mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/student-h5.git
synced 2025-12-10 03:16:46 +08:00
init 初始化
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user