mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +08:00
fix: Unnecesarily loop in the static menu. (#660)
* fix: Unnecesarily loop in the static menu. * change visivility with dinamic attribute. * Update menu.js Co-authored-by: EdwinBetanc0urt <EdwinBetanco0urt@outlook.com>
This commit is contained in:
parent
7617bdbdf1
commit
e9d1613b8a
@ -157,13 +157,21 @@ function getRouteFromMenuItem({ menu, roleUuid, organizationUuid }) {
|
||||
* @author elsiosanchez <elsiosanches@gmail.com>
|
||||
* @param {object} staticRoutes static routes
|
||||
* @param {object} permiseRole role permissions
|
||||
* @returns {object} routes with hidden/show
|
||||
*/
|
||||
function hidenStactiRoutes({ staticRoutes, permiseRole }) {
|
||||
const { isAllowInfoProduct } = permiseRole
|
||||
if (!isAllowInfoProduct) {
|
||||
// does not change the hidden visibility of ProductInfo
|
||||
return staticRoutes
|
||||
}
|
||||
|
||||
return staticRoutes.map(route => {
|
||||
if (route.path === '/ProductInfo') {
|
||||
return {
|
||||
...route,
|
||||
hidden: !permiseRole.isAllowInfoProduct
|
||||
// is hidden by default, change to be visible
|
||||
hidden: !isAllowInfoProduct
|
||||
}
|
||||
}
|
||||
return {
|
||||
|
Loading…
x
Reference in New Issue
Block a user