cool-admin-vue/cool/modules/base/utils/index.js
2021-02-28 22:24:54 +08:00

32 lines
531 B
JavaScript

export const revisePath = (path) => {
if (!path) {
return "";
}
if (path[0] == "/") {
return path;
} else {
return `/${path}`;
}
};
export function firstMenu(list) {
let path = "";
const fn = (arr) => {
arr.forEach((e) => {
if (e.type == 1) {
if (!path) {
path = e.path;
}
} else {
fn(e.children);
}
});
};
fn(list);
return path || "/404";
}