mirror of https://github.com/dtm-labs/dtm.git
csharpjavadistributed-transactionsdtmgogolangmicroservicenodejsphpdatabasesagaseatatcctransactiontransactionsxapythondistributed
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
751 B
23 lines
751 B
import { useRoute } from 'vue-router';
|
|
import { IMenubarList } from '../type/store/layout';
|
|
|
|
export const findCurrentMenubar = (menuList: IMenubarList[], root?:boolean) => {
|
|
const route = useRoute()
|
|
let arr:IMenubarList[] | IMenubarList = []
|
|
for (let i = 0; i < menuList.length; i++) {
|
|
const v = menuList[i];
|
|
const usePath = v.meta.activeMenu || v.redirect || v.path;
|
|
const pos = usePath.lastIndexOf('/')
|
|
const rootPath = pos == 0 ? usePath : usePath.substring(0, pos)
|
|
if (route.path.indexOf(rootPath) !== -1) {
|
|
if (!root) {
|
|
arr = v.children as IMenubarList[]
|
|
} else {
|
|
arr = v
|
|
}
|
|
break
|
|
}
|
|
}
|
|
|
|
return arr
|
|
}
|
|
|