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