Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
增加菜单和菜单路由调整常见问题
Browse files Browse the repository at this point in the history
  • Loading branch information
wangjue666 committed Oct 16, 2023
1 parent 80b99f5 commit 0a2e08f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions other/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,29 @@ proxy 代理不成功,没有代理到实际地址?
## 组件库问题

跟组件库相关的问题可以查看[常见问题](https://2x.antdv.com/docs/vue/faq-cn/)

## 动态调整菜单问题

菜单数据的值被存放在 `store/modules/permission` store 中, 你可以在这里进行修改

## 更灵活的菜单路由权限控制

你可以在 `store/modules/permission`下, 修改 `routeFilter` 方法来进行更灵活的菜单路由权限控制

```
const routeFilter = (route: AppRouteRecordRaw) => {
const { meta } = route;
// 抽出角色
const { roles } = meta || {};
// 添加你的自定义逻辑来过滤路由和菜单
if (xxx) {
return false;
}
if (!roles) return true;
// 进行角色权限判断
return roleList.some((role) => roles.includes(role));
};
```

0 comments on commit 0a2e08f

Please sign in to comment.