Commit 1b472073 authored by 王玉鑫's avatar 王玉鑫

feat: 菜单项选中状态修改

parent ada8249e
...@@ -62,8 +62,12 @@ const menuList = computed(() => { ...@@ -62,8 +62,12 @@ const menuList = computed(() => {
* 当前菜单path * 当前菜单path
*/ */
const currentPath = computed(() => { const currentPath = computed(() => {
if (`#${route.path}` === window.location.hash) { const { menuRouteName } = route.meta;
return route.path; const { fullPath, path } = route;
if (menuRouteName) {
return router.resolve({ name: menuRouteName }).path;
} else if (router.resolve(fullPath).href === window.location.hash) {
return path;
} else { } else {
return ''; return '';
} }
......
...@@ -160,6 +160,9 @@ const routes: readonly RouteRecordRaw[] = [ ...@@ -160,6 +160,9 @@ const routes: readonly RouteRecordRaw[] = [
// 产业政策详情 // 产业政策详情
...gen(RouteName.industryPolicyDetail), ...gen(RouteName.industryPolicyDetail),
component: IndustryPolicyDetail, component: IndustryPolicyDetail,
meta: {
menuRouteName: RouteName.industryPolicy,
},
}, },
{ {
// 地图选址 // 地图选址
...@@ -172,7 +175,7 @@ const routes: readonly RouteRecordRaw[] = [ ...@@ -172,7 +175,7 @@ const routes: readonly RouteRecordRaw[] = [
component: AboutUs, component: AboutUs,
}, },
{ {
// 关于立业云 // 联系我们
...gen(RouteName.contactUs), ...gen(RouteName.contactUs),
component: ContactUs, component: ContactUs,
}, },
...@@ -185,21 +188,33 @@ const routes: readonly RouteRecordRaw[] = [ ...@@ -185,21 +188,33 @@ const routes: readonly RouteRecordRaw[] = [
// 产业园详情 // 产业园详情
...gen(RouteName.industrialParkDetail), ...gen(RouteName.industrialParkDetail),
component: IndustrialParkDetail, component: IndustrialParkDetail,
meta: {
menuRouteName: RouteName.industrialParkList,
},
}, },
{ {
// 开发区详情 // 开发区详情
...gen(RouteName.developZoneDetail), ...gen(RouteName.developZoneDetail),
component: DevelopZoneDetail, component: DevelopZoneDetail,
meta: {
menuRouteName: RouteName.developZoneList,
},
}, },
{ {
// 开发区详情 // 土地详情
...gen(RouteName.landDetail), ...gen(RouteName.landDetail),
component: LandDetail, component: LandDetail,
meta: {
menuRouteName: RouteName.landList,
},
}, },
{ {
// 开发区详情 // 载体详情
...gen(RouteName.carrierDetail), ...gen(RouteName.carrierDetail),
component: CarrierDetail, component: CarrierDetail,
meta: {
menuRouteName: RouteName.carrierList,
},
}, },
{ {
// 用户中心 // 用户中心
......
import 'vue-router'; import 'vue-router';
import { RouteName } from '@/router/router.ts';
declare module 'vue-router' { declare module 'vue-router' {
interface RouteMeta { interface RouteMeta {
menuName?: string; menuName?: string;
parentMenuName?: string; parentMenuName?: string;
menuRouteName?: RouteName;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment