1
0
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:
Edwin Betancourt 2021-03-21 19:03:07 -04:00 committed by GitHub
parent 7617bdbdf1
commit e9d1613b8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {