接口初始化 第一版

This commit is contained in:
yuping
2022-11-21 15:26:30 +08:00
parent cd874c0373
commit 8fa76327be
3 changed files with 9 additions and 9 deletions

View File

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