|
@@ -6,14 +6,23 @@ const viewRouterModules = import.meta.glob('../views/**/*.vue')
|
|
|
|
|
|
// 子路由
|
|
|
const childRoutes = Object.keys(viewRouterModules).map((path)=>{
|
|
|
- const childName = path.match(/\.\.\/views\/(.*)\.vue$/)[1].split('/')[1];
|
|
|
+ let urlPath = path.match(/\.\.\/views\/(.*)\.vue$/)[1];
|
|
|
+ let keepAlive = false
|
|
|
+ let showTabBar = true
|
|
|
+ // 是否需要显示底部tabBar
|
|
|
+ if(['goods/detail'].includes(urlPath)) showTabBar = false
|
|
|
+ // 是否需要传递params
|
|
|
+ // todo
|
|
|
return {
|
|
|
- path: `/${childName.toLowerCase()}`,
|
|
|
- name: childName,
|
|
|
- component: viewRouterModules[path]
|
|
|
- }
|
|
|
+ path: urlPath.toLowerCase(),
|
|
|
+ name: urlPath.replaceAll('/',''),
|
|
|
+ component: viewRouterModules[path],
|
|
|
+ meta: {
|
|
|
+ keepAlive,
|
|
|
+ showTabBar
|
|
|
+ }
|
|
|
+ }
|
|
|
})
|
|
|
-console.log(viewRouterModules)
|
|
|
// 根路由
|
|
|
const rootRoutes = Object.keys(mainRouterModules).map((path) => {
|
|
|
const name = path.match(/\.\.\/layout\/(.*)\.vue$/)[1].toLowerCase();
|
|
@@ -22,7 +31,7 @@ const rootRoutes = Object.keys(mainRouterModules).map((path) => {
|
|
|
return {
|
|
|
path: '/',
|
|
|
name,
|
|
|
- redirect: '/home',
|
|
|
+ redirect: '/home/home',
|
|
|
component: mainRouterModules[path],
|
|
|
children: childRoutes
|
|
|
};
|