瀏覽代碼

fix #972 delete extra /

jim 7 年之前
父節點
當前提交
27266c56c2
共有 2 個文件被更改,包括 3 次插入3 次删除
  1. 1 1
      src/common/router.js
  2. 2 2
      src/layouts/BasicLayout.js

+ 1 - 1
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) {

+ 2 - 2
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);