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

feat: 菜单项选中状态修改

parent ada8249e
......@@ -62,8 +62,12 @@ const menuList = computed(() => {
* 当前菜单path
*/
const currentPath = computed(() => {
if (`#${route.path}` === window.location.hash) {
return route.path;
const { menuRouteName } = route.meta;
const { fullPath, path } = route;
if (menuRouteName) {
return router.resolve({ name: menuRouteName }).path;
} else if (router.resolve(fullPath).href === window.location.hash) {
return path;
} else {
return '';
}
......
......@@ -160,6 +160,9 @@ const routes: readonly RouteRecordRaw[] = [
// 产业政策详情
...gen(RouteName.industryPolicyDetail),
component: IndustryPolicyDetail,
meta: {
menuRouteName: RouteName.industryPolicy,
},
},
{
// 地图选址
......@@ -172,7 +175,7 @@ const routes: readonly RouteRecordRaw[] = [
component: AboutUs,
},
{
// 关于立业云
// 联系我们
...gen(RouteName.contactUs),
component: ContactUs,
},
......@@ -185,21 +188,33 @@ const routes: readonly RouteRecordRaw[] = [
// 产业园详情
...gen(RouteName.industrialParkDetail),
component: IndustrialParkDetail,
meta: {
menuRouteName: RouteName.industrialParkList,
},
},
{
// 开发区详情
...gen(RouteName.developZoneDetail),
component: DevelopZoneDetail,
meta: {
menuRouteName: RouteName.developZoneList,
},
},
{
// 开发区详情
// 土地详情
...gen(RouteName.landDetail),
component: LandDetail,
meta: {
menuRouteName: RouteName.landList,
},
},
{
// 开发区详情
// 载体详情
...gen(RouteName.carrierDetail),
component: CarrierDetail,
meta: {
menuRouteName: RouteName.carrierList,
},
},
{
// 用户中心
......
import 'vue-router';
import { RouteName } from '@/router/router.ts';
declare module 'vue-router' {
interface RouteMeta {
menuName?: 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