Commit 588f3de1 by 冒粤蓉

fix

1 parent 8beb4d2b
......@@ -213,7 +213,23 @@ export default {
item.menuIcon = require(`../../../assets/images/icon/${menuObj[item.origin.menuName] || 'setting-icon'}.png`);
})
}
const sortMenu = (param) => {
if (param instanceof Array) {
const arr1 = param.sort((a, b) => a.order - b.order)
arr1.forEach(item => {
if (item.children && item.children.length > 1) {
sortMenu(item)
} else {
item.children.sort((a, b) => a.order - b.order)
}
})
} else if (param instanceof Object) {
param.children.sort((a, b) => a.order - b.order)
}
return param
}
// 获取菜单树接口
const getServerTree = async (isInit) => {
const menuService = new MenuService();
......@@ -223,7 +239,7 @@ export default {
const resData = res.data;
let curBreadcrumb = localStorage.getItem('breadcrumb');
// const getNewTree = getMenuTree(res.data, menuTreeLocalList)
state.menuList = resData;
state.menuList = sortMenu(resData);
// 初始化操作
let showEmpty = false;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!