From edbe01b3e1ee4030ed41a8d76821d07d87e32fa3 Mon Sep 17 00:00:00 2001 From: yutent Date: Tue, 7 Jan 2025 14:46:08 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E6=96=B0=E7=89=88=E9=85=8D?= =?UTF-8?q?=E5=A5=97=E4=B8=AD=E9=97=B4=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- middleware/router.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/middleware/router.js b/middleware/router.js index bc89bd5..253fda7 100644 --- a/middleware/router.js +++ b/middleware/router.js @@ -12,7 +12,7 @@ export function createRouter() { let dynamic = this.get('dynamic') let name = dynamic ? 'index' : req.controller let ModuleController = this.$load(name) - let paths = req.path.concat() + let actions = req.actions.concat() // 1. 先判断控制器是否存在 if (!ModuleController) { @@ -20,8 +20,8 @@ export function createRouter() { } // 2. 默认二级路由为index - if (paths.length < 1 && dynamic === false) { - paths.push('index') + if (actions.length < 1 && dynamic === false) { + actions.push('index') } // 3. 实例化控制器 @@ -49,13 +49,13 @@ export function createRouter() { } if (dynamic) { - return ctrol.indexAction.apply(ctrol, paths) + return ctrol.indexAction.apply(ctrol, actions) } else { - route = paths.shift() + route = actions.shift() act = route + 'Action' if (ctrol[act]) { - return ctrol[act].apply(ctrol, paths) + return ctrol[act].apply(ctrol, actions) } else { err = new Error(`Action [${route}] not found`) err.status = 404