fix: showLink is false,children menu still showing

This commit is contained in:
xiaoxian521 2021-10-12 13:45:59 +08:00
parent 9c70c5a8dc
commit c8e90b4bd7

View File

@ -13,9 +13,17 @@ export const usePermissionStore = defineStore({
}),
actions: {
asyncActionRoutes(routes) {
const filterTree = data => {
const newTree = data.filter(v => v.meta.showLink);
newTree.forEach(
v => v.children && (v.children = filterTree(v.children))
);
return newTree;
};
if (this.wholeRoutes.length > 0) return;
this.wholeRoutes = ascending(this.constantRoutes.concat(routes)).filter(
v => v.meta.showLink
this.wholeRoutes = filterTree(
ascending(this.constantRoutes.concat(routes))
);
const getButtonAuth = (arrRoutes: Array<string>) => {