From 23cf2fab0b525c4737eeb14a571b863e3152882a Mon Sep 17 00:00:00 2001 From: chenghongxing <1126263215@qq.com> Date: Mon, 10 Aug 2020 11:54:16 +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 +++--- src/router/config.js | 3 +++ 2 files changed, 6 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]) } } }) diff --git a/src/router/config.js b/src/router/config.js index 6947cd5..fa95941 100644 --- a/src/router/config.js +++ b/src/router/config.js @@ -82,6 +82,9 @@ const options = { { path: 'query', name: '查询表格', + meta: { + authority: 'queryForm', + }, component: () => import('@/pages/list/QueryList'), }, {