From 80558e21646ebf7c3c31d02b65cb1b6fd0322962 Mon Sep 17 00:00:00 2001 From: chenghongxing <1126263215@qq.com> Date: Mon, 10 Aug 2020 12:01:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20the=20exception=20when=20using=20authori?= =?UTF-8?q?ze=20inject=20function;=20:bug:=20=E4=BF=AE=E5=A4=8D=EF=BC=9A?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E6=9D=83=E9=99=90=E6=A0=A1=E9=AA=8C=E6=B3=A8?= =?UTF-8?q?=E5=85=A5=E5=8A=9F=E8=83=BD=E6=97=B6=E5=87=BA=E7=8E=B0=E7=9A=84?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/authority-plugin.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/authority-plugin.js b/src/plugins/authority-plugin.js index 7c40aad..65cba84 100644 --- a/src/plugins/authority-plugin.js +++ b/src/plugins/authority-plugin.js @@ -31,7 +31,7 @@ const hasInjected = (method) => method.toString().indexOf('//--auth-inject') !== const auth = function(authConfig, permission, role, permissions, roles) { const {check, type} = authConfig if (check && typeof check === 'function') { - return check(permission, role, permissions, roles) + return check.apply(this, [permission, role, permissions, roles]) } else { if (type === 'permission') { return permission && permission.operation && permission.operation.indexOf(check) !== -1 @@ -96,7 +96,7 @@ const AuthorityPlugin = { this.$options.methods[key] = function () { //--auth-inject if (this.$auth(check, type)) { - return method(...arguments) + return method.apply(this, arguments) } else { if (onFailure && typeof onFailure === 'function') { this[`$${check}Failure`] = onFailure @@ -128,7 +128,7 @@ const AuthorityPlugin = { if (!type) { type = permission ? 'permission' : 'role' } - return auth({check, type}, permission, role, permissions, roles) + return auth.apply(this, [{check, type}, permission, role, permissions, roles]) } } })