|
|
|
|
@ -1,4 +1,15 @@
|
|
|
|
|
const Layout = () => import('@/layout/index.vue');
|
|
|
|
|
import { route } from '@/utils/tools';
|
|
|
|
|
const titleArr = [
|
|
|
|
|
{
|
|
|
|
|
key: 'jsx',
|
|
|
|
|
title: '使用jsx',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'tools',
|
|
|
|
|
title: '工具方法',
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// @/views/demo/**/*.vue
|
|
|
|
|
/**
|
|
|
|
|
@ -22,10 +33,19 @@ const Layout = () => import('@/layout/index.vue');
|
|
|
|
|
const firstLevelComponents = import.meta.glob('@/views/demo/*.vue');
|
|
|
|
|
const secondLevelComponents = import.meta.glob('@/views/demo/*/*.vue');
|
|
|
|
|
const components = { ...firstLevelComponents, ...secondLevelComponents };
|
|
|
|
|
console.log(components);
|
|
|
|
|
|
|
|
|
|
const demoRoutes = Object.keys(components).map((path) => {
|
|
|
|
|
console.log(path);
|
|
|
|
|
const component = components[path];
|
|
|
|
|
const isHasIndex = path.includes('/index.vue');
|
|
|
|
|
let cptPath = path.replace(route.FILE_NAME_PREFIX, '');
|
|
|
|
|
cptPath = isHasIndex ? cptPath.replace('/index.vue', '') : path.replace('.vue', '');
|
|
|
|
|
return {
|
|
|
|
|
path: cptPath,
|
|
|
|
|
name: route.convertPathToName(cptPath),
|
|
|
|
|
component: components[path],
|
|
|
|
|
meta: {
|
|
|
|
|
title: route.getTitleFromPathStr(titleArr, cptPath),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
@ -38,15 +58,5 @@ export default {
|
|
|
|
|
title: '示例',
|
|
|
|
|
rank: 1,
|
|
|
|
|
},
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
path: '/demo/jsx',
|
|
|
|
|
name: 'DemoJsx',
|
|
|
|
|
component: () => import('@/views/demo/jsx/index.vue'),
|
|
|
|
|
meta: {
|
|
|
|
|
title: '使用jsx',
|
|
|
|
|
showLink: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
children: [...demoRoutes],
|
|
|
|
|
} satisfies RouteConfigsTable;
|
|
|
|
|
|