iview-admin
iview-admin copied to clipboard
access:路由有多个权限值时权限判断的问题
如图给路由设置多个权限

当前权限判断的源码

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

我博客给了详细解决方案,请看 http://pangguoming.com/blog/2018/01/10/vue-permission/
@HazyLiA 你这截的源码是哪的,我怎么没找到
@lison16 iview-admin/src/router/index.js 41行
为何我设置多个权限制还是不行啊
看下2.0
@lison16 2.0修复了这个问题? 而且我在仓库中没有找到2.0是没有发布?
这个很简单.照着我的做就行.亲测成功

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

/**
-
@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"[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.
哦 没事 我在找找资料
------------------ 原始邮件 ------------------ 发件人: "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 [email protected] 发送时间: 2019年6月12日 15:20 收件人: iview/iview-admin [email protected] 抄送: Eli [email protected], Comment [email protected] 主题: 回复:[iview/iview-admin] access:路由有多个权限值时权限判断的问题 (#410)
小白 还是看不太懂,大佬能留个联系方式吗 ------------------ 原始邮件 ------------------ 发件人: "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.
小白 还是看不太懂,大佬能留个联系方式吗 ------------------ 原始邮件 ------------------ 发件人: "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