mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2024-11-01 22:20:27 +08:00
32 lines
531 B
JavaScript
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";
|
|
}
|