cool-admin-vue/cool/components/base/utils/index.js

32 lines
531 B
JavaScript
Raw Normal View History

2021-02-28 01:55:04 +08:00
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";
}