Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

access:路由有多个权限值时权限判断的问题 #410

Open
HazyLiA opened this issue Jan 10, 2018 · 15 comments
Open

access:路由有多个权限值时权限判断的问题 #410

HazyLiA opened this issue Jan 10, 2018 · 15 comments

Comments

@HazyLiA
Copy link

HazyLiA commented Jan 10, 2018

如图给路由设置多个权限
tim 20180110165651

当前权限判断的源码
tim 20180110165608

如图,console打印,Array和Int类型无法正确判断,需要Util.oneOf方法
tim 20180110165713

@pangguoming
Copy link

pangguoming commented Jan 11, 2018

我博客给了详细解决方案,请看 http://pangguoming.com/blog/2018/01/10/vue-permission/

@lison16
Copy link
Contributor

lison16 commented Jan 12, 2018

@HazyLiA 你这截的源码是哪的,我怎么没找到

@HazyLiA
Copy link
Author

HazyLiA commented Jan 15, 2018

@lison16
iview-admin/src/router/index.js
41行

@batmanSix
Copy link

为何我设置多个权限制还是不行啊

@lison16
Copy link
Contributor

lison16 commented Jul 10, 2018 via email

@batmanSix
Copy link

batmanSix commented Jul 10, 2018

@lison16 2.0修复了这个问题? 而且我在仓库中没有找到2.0是没有发布?

@duwei0324
Copy link

这个很简单.照着我的做就行.亲测成功
image

@duwei0324
Copy link

纠正一下.刚刚那个有bug.
image

@netyilei
Copy link

/**

  • @param {Array} target 目标数组

  • @param {Array} arr 需要查询的数组

  • @description 判断要查询的数组是否至少有一个元素包含在目标数组中
    */
    export const hasOneOf = (targetarr, arr) => {
    // 不知道是否会有都是数组的情况 以防万一
    if (targetarr instanceof Array && arr instanceof Array)
    {
    let bSet = new Set(arr)
    let intersection = Array.from( new Set( targetarr.filter( v => bSet.has(v) ) ) );
    return intersection instanceof Array && intersection.length > 0;
    }

    if (targetarr instanceof Array && !(arr instanceof Array) )
    {
    return targetarr.some(_ => arr == _);
    }

    if ( !(targetarr instanceof Array) )
    {
    return arr.indexOf(targetarr) > -1
    }
    }

@yyword
Copy link

yyword commented Jun 12, 2019

这个能下载你的源码看看吗

@netyilei
Copy link

netyilei commented Jun 12, 2019 via email

@yyword
Copy link

yyword commented Jun 12, 2019 via email

@netyilei
Copy link

netyilei commented Jun 12, 2019 via email

@yyword
Copy link

yyword commented Jun 12, 2019 via email

@luterc
Copy link

luterc commented Sep 30, 2019

小白 还是看不太懂,大佬能留个联系方式吗 ------------------ 原始邮件 ------------------ 发件人: "Eli"notifications@github.com; 发送时间: 2019年6月12日(星期三) 下午3:23 收件人: "iview/iview-admin"iview-admin@noreply.github.com; 抄送: "稻香"2370590166@qq.com;"Comment"comment@noreply.github.com; 主题: Re: [iview/iview-admin] access:路由有多个权限值时权限判断的问题 (#410) 相关问题我有写一段修改代码 修改下就好了。导航路由设计的确实有缺陷。 如果有独特的需求,还是自己设计路由比较好。

------------------ 原始邮件 ------------------ 发件人: yyword notifications@github.com 发送时间: 2019年6月12日 15:20 收件人: iview/iview-admin iview-admin@noreply.github.com 抄送: Eli 827887@qq.com, Comment comment@noreply.github.com 主题: 回复:[iview/iview-admin] access:路由有多个权限值时权限判断的问题 (#410) — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

我刚好写了个例子,希望不会太晚 ~~:)
https://github.com/MayBeWrong/iview-admin-dynamic-router.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants