Iview-admin: 多级菜单权限问题

Created on 26 Feb 2018  ·  7Comments  ·  Source: iview/iview-admin

如图所示:
image
1及和二级菜单都配置权限值时,
image
在登陆代码如下:
image

会爆权限不足
image

Most helpful comment

我使用的版本是v1.2.3,也遇到了相似的问题:

1519973844 1

我在所有页面都配置了多个权限,权限的判断不符合预期。

然后我在router/index.js 第41行修改,改用现有的函数判断数组或数字,使得在不触发Util.toDefaultPage 替换路由名的条件下避开403页面:

1519974493 1

在store/modules/app.js 第53行作相同修改,为了正常显示菜单:

1519974311 1

希望能得到更完善或官方的权限使用做法。

All 7 comments

410

应该有帮助

@HazyLiA 你是怎么处理的

iview-admin/src/router/index.js 源码41行,在多权限状态下,权限对象的属性是Array,和Int对象的判断永远是false啊
把access: [1, 2, .....]对象里的数据遍历一遍咯

我使用的版本是v1.2.3,也遇到了相似的问题:

1519973844 1

我在所有页面都配置了多个权限,权限的判断不符合预期。

然后我在router/index.js 第41行修改,改用现有的函数判断数组或数字,使得在不触发Util.toDefaultPage 替换路由名的条件下避开403页面:

1519974493 1

在store/modules/app.js 第53行作相同修改,为了正常显示菜单:

1519974311 1

希望能得到更完善或官方的权限使用做法。

已经把权限全部改掉了

util.showThisRoute中的
if (typeof itAccess === 'object' && Array.isArray(itAccess)) {
应改为if (typeof itAccess === 'object' || Array.isArray(itAccess)) {
此处BUG很有意思!哈哈

大家可别听楼上说的,我照着他的改了结果是错误的。原版 ‘&&’ 才是对的。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Miku-Zeng picture Miku-Zeng  ·  3Comments

shidalin picture shidalin  ·  4Comments

hardphp picture hardphp  ·  6Comments

Nightsky-Dec picture Nightsky-Dec  ·  5Comments

iMactool picture iMactool  ·  5Comments