diff --git a/src/pages/ideContainer/config/menuData.ts b/src/pages/ideContainer/config/menuData.ts index e1f8679..83169d2 100644 --- a/src/pages/ideContainer/config/menuData.ts +++ b/src/pages/ideContainer/config/menuData.ts @@ -1,6 +1,7 @@ export const menuData = [ { title: '应用编排', + key: 'appFlow', children: null, path: 'appFlow' }, @@ -27,18 +28,21 @@ export const menuData = [ { title: '事件', children: null, - path: 'event' + path: 'event', + key: 'event' }, { title: '全局变量', children: null, - path: 'globalVar' + path: 'globalVar', + key: 'globalVar' } ]; export const menuData2 = [ { title: '组件列表', + key: 'componentList', children: [ { title: '我的组件', @@ -60,16 +64,19 @@ export const menuData2 = [ { title: '组件编码', children: null, - path: 'componentCoding' + path: 'componentCoding', + key: 'componentCoding' }, { title: '组件部署', children: null, - path: 'componentDeployment' + path: 'componentDeployment', + key: 'componentDeployment' }, { title: '组件测试', children: null, - path: 'componentTest' + path: 'componentTest', + key: 'componentTest' } ]; \ No newline at end of file diff --git a/src/pages/ideContainer/index.tsx b/src/pages/ideContainer/index.tsx index 526354f..2e461df 100644 --- a/src/pages/ideContainer/index.tsx +++ b/src/pages/ideContainer/index.tsx @@ -158,7 +158,7 @@ function IDEContainer() { if (menuItem) { setSelected({ currentPath: menuItem.path, - currentKey: '' // 这里可以优化为实际的key值 + currentKey: menuItem.key }); } } diff --git a/src/pages/ideContainer/sideBar.tsx b/src/pages/ideContainer/sideBar.tsx index 4b6e4ae..cc45a29 100644 --- a/src/pages/ideContainer/sideBar.tsx +++ b/src/pages/ideContainer/sideBar.tsx @@ -5,6 +5,7 @@ import { menuData, menuData2 } from './config/menuData'; interface MenuItemType { title: string; + key?: string; children?: MenuItemType[]; path?: string; icon?: React.ReactNode; @@ -42,9 +43,9 @@ const SideBar: React.FC = ({ onMenuSelect, selectedKey, identity } {menu.map((item, index) => (
{ - onMenuSelect?.({ currentPath: item.path, currentKey: `${index}` }); + onMenuSelect?.({ currentPath: item.path, currentKey: `${item.key}` }); }} >