From 27266c56c2099bebdcdf6147a26c0301d03ffb08 Mon Sep 17 00:00:00 2001 From: jim Date: Mon, 26 Feb 2018 10:31:08 +0800 Subject: [PATCH] fix #972 delete extra / --- src/common/router.js | 2 +- src/layouts/BasicLayout.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/router.js b/src/common/router.js index 5df24776..882196a9 100644 --- a/src/common/router.js +++ b/src/common/router.js @@ -175,7 +175,7 @@ export const getRouterData = (app) => { // Regular match item name // eg. router /user/:id === /user/chen const pathRegexp = pathToRegexp(path); - const menuKey = Object.keys(menuData).find(key => pathRegexp.test(`/${key}`)); + const menuKey = Object.keys(menuData).find(key => pathRegexp.test(`${key}`)); let menuItem = {}; // If menuKey is not empty if (menuKey) { diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 062198c1..e1534d05 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -27,8 +27,8 @@ const getRedirect = (item) => { if (item && item.children) { if (item.children[0] && item.children[0].path) { redirectData.push({ - from: `/${item.path}`, - to: `/${item.children[0].path}`, + from: `${item.path}`, + to: `${item.children[0].path}`, }); item.children.forEach((children) => { getRedirect(children); -- GitLab