iview-admin icon indicating copy to clipboard operation
iview-admin copied to clipboard

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

Open HazyLiA opened this issue 7 years ago • 15 comments

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

当前权限判断的源码 tim 20180110165608

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

HazyLiA avatar Jan 10 '18 09:01 HazyLiA

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

pangguoming avatar Jan 11 '18 06:01 pangguoming

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

lison16 avatar Jan 12 '18 02:01 lison16

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

HazyLiA avatar Jan 15 '18 01:01 HazyLiA

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

batmanSix avatar Jul 10 '18 08:07 batmanSix

看下2.0

lison16 avatar Jul 10 '18 08:07 lison16

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

batmanSix avatar Jul 10 '18 08:07 batmanSix

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

duwei0324 avatar Aug 30 '18 07:08 duwei0324

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

duwei0324 avatar Aug 30 '18 07:08 duwei0324

/**

  • @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 } }

netyilei avatar Mar 11 '19 17:03 netyilei

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

yyword avatar Jun 12 '19 07:06 yyword

我的源码不方便公开------------------ 原始邮件 ------------------ 发件人: "yyword"[email protected] 发送时间: 2019年6月12日(星期三) 下午3:15 收件人: "iview/iview-admin"[email protected]; 抄送: "Eli"[email protected];"Comment"[email protected]; 主题: Re: [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.

netyilei avatar Jun 12 '19 07:06 netyilei

哦 没事 我在找找资料

------------------ 原始邮件 ------------------ 发件人: "Eli"[email protected]; 发送时间: 2019年6月12日(星期三) 下午3:17 收件人: "iview/iview-admin"[email protected]; 抄送: "稻香"[email protected];"Comment"[email protected]; 主题: Re: [iview/iview-admin] access:路由有多个权限值时权限判断的问题 (#410)

我的源码不方便公开------------------ 原始邮件 ------------------ 发件人: "yyword"[email protected] 发送时间: 2019年6月12日(星期三) 下午3:15 收件人: "iview/iview-admin"[email protected]; 抄送: "Eli"[email protected];"Comment"[email protected]; 主题: Re: [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. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

yyword avatar Jun 12 '19 07:06 yyword

相关问题我有写一段修改代码 修改下就好了。导航路由设计的确实有缺陷。 如果有独特的需求,还是自己设计路由比较好。

------------------ 原始邮件 ------------------ 发件人: yyword [email protected] 发送时间: 2019年6月12日 15:20 收件人: iview/iview-admin [email protected] 抄送: Eli [email protected], Comment [email protected] 主题: 回复:[iview/iview-admin] access:路由有多个权限值时权限判断的问题 (#410)

netyilei avatar Jun 12 '19 07:06 netyilei

小白 还是看不太懂,大佬能留个联系方式吗 ------------------ 原始邮件 ------------------ 发件人: "Eli"[email protected]; 发送时间: 2019年6月12日(星期三) 下午3:23 收件人: "iview/iview-admin"[email protected]; 抄送: "稻香"[email protected];"Comment"[email protected]; 主题: Re: [iview/iview-admin] access:路由有多个权限值时权限判断的问题 (#410)

相关问题我有写一段修改代码 修改下就好了。导航路由设计的确实有缺陷。 如果有独特的需求,还是自己设计路由比较好。

------------------ 原始邮件 ------------------ 发件人: yyword [email protected] 发送时间: 2019年6月12日 15:20 收件人: iview/iview-admin [email protected] 抄送: Eli [email protected], Comment [email protected] 主题: 回复:[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.

yyword avatar Jun 12 '19 07:06 yyword

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

luterc avatar Sep 30 '19 16:09 luterc