!236 update 收起菜单时从展开列表中移除对应菜单

Merge pull request !236 from Lau/dev
This commit is contained in:
疯狂的狮子Li
2025-08-14 01:17:48 +00:00
committed by Gitee

View File

@@ -44,6 +44,7 @@
:default-expand-all="false" :default-expand-all="false"
lazy lazy
:load="getChildrenList" :load="getChildrenList"
:expand-change="expandMenuHandle"
> >
<el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="160"></el-table-column> <el-table-column prop="menuName" label="菜单名称" :show-overflow-tooltip="true" width="160"></el-table-column>
<el-table-column prop="icon" label="图标" align="center" width="100"> <el-table-column prop="icon" label="图标" align="center" width="100">
@@ -353,6 +354,13 @@ const getChildrenList = async (row: any, treeNode: unknown, resolve: (data: any[
resolve(children); resolve(children);
}; };
/** 收起菜单时从menuExpandMap中删除对应菜单id数据 */
const expandMenuHandle = async (row: any, expanded: boolean) => {
if (!expanded) {
menuExpandMap.value[row.menuId] = undefined;
}
};
/** 刷新展开的菜单数据 */ /** 刷新展开的菜单数据 */
const refreshLoadTree = (parentId: string | number) => { const refreshLoadTree = (parentId: string | number) => {
if (menuExpandMap.value[parentId]) { if (menuExpandMap.value[parentId]) {