xuruiqian
2025-02-25 e85ab165147c37b571ea67ce6f6ae9ae55a96070
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
let array = [
    {
        path: '/admin/system/Notification',
        children: []
    },
    {
        path: '/admin/system/Config',
        children: []
    },
    {
        path: '/admin/system/AuditTrail',
        children: []
    },
    {
        path: '/admin/system/Log',
        children: []
    },
    {
        path: '/admin/system/Menu',
        children: []
    },
]
 
export const routerIndex = (val) => {
    for (let i = 0; i < array.length; i++) {
        if (array[i].path == val || array[i].children.includes(val)) {
            return i
        }
    }
}
 
export const getRouter = (val) => {
    let path = ""
    for (let i = 0; i < array.length; i++) {
        if (array[i].children.includes(val)) {
            path = array[i].path
        }
    }
    return path;
}