From 87aa17b6d7c1c074a7aaa6dd62ddfe21ef4e73b3 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 22 May 2014 05:47:58 -0400 Subject: [PATCH] refactor(client) route --- lib/client.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/client.js b/lib/client.js index 8fc741d8..06d9127f 100644 --- a/lib/client.js +++ b/lib/client.js @@ -172,13 +172,15 @@ var Util, DOM, CloudFunc; this.route = function(path) { var module, file, current, msg, - query = path.split('/'), - length = query.length; + query = path.split('/'); - if (length) { - module = Util.getStrBigFirst(query[1]); - file = query[2]; - current = DOM.getCurrentFileByName(file); + if (path) { + module = query[0]; + module = Util.slice(module, 1).join(''); + module = Util.getStrBigFirst(module); + + file = query[1]; + current = DOM.getCurrentFileByName(file); if (file && !current) { msg = CloudFunc.formatMsg('set current file', file, 'error');