@yysports/tools 2.2.3 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Utils/route.d.ts +1 -0
- package/dist/Utils/route.js +7 -2
- package/lib/Utils/route.d.ts +1 -0
- package/lib/Utils/route.js +6 -2
- package/package.json +1 -1
package/dist/Utils/route.d.ts
CHANGED
package/dist/Utils/route.js
CHANGED
|
@@ -6,10 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export var getModuleNameByUmi = function getModuleNameByUmi(onRouteChangeArgs, menuNameMap) {
|
|
8
8
|
var location = onRouteChangeArgs.location,
|
|
9
|
-
routes = onRouteChangeArgs.routes
|
|
9
|
+
routes = onRouteChangeArgs.routes,
|
|
10
|
+
basename = onRouteChangeArgs.basename;
|
|
10
11
|
var pathname = location.pathname;
|
|
12
|
+
var routePath = pathname;
|
|
13
|
+
if (basename !== '/') {
|
|
14
|
+
routePath = pathname.replace(basename, '');
|
|
15
|
+
}
|
|
11
16
|
var currentRouteKey = Object.keys(routes).find(function (v) {
|
|
12
|
-
return routes[v].path ===
|
|
17
|
+
return routes[v].path === routePath;
|
|
13
18
|
});
|
|
14
19
|
|
|
15
20
|
// 如果路由不存在或是重定向路由,直接返回
|
package/lib/Utils/route.d.ts
CHANGED
package/lib/Utils/route.js
CHANGED
|
@@ -23,10 +23,14 @@ __export(route_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(route_exports);
|
|
25
25
|
var getModuleNameByUmi = (onRouteChangeArgs, menuNameMap) => {
|
|
26
|
-
const { location, routes } = onRouteChangeArgs;
|
|
26
|
+
const { location, routes, basename } = onRouteChangeArgs;
|
|
27
27
|
const { pathname } = location;
|
|
28
|
+
let routePath = pathname;
|
|
29
|
+
if (basename !== "/") {
|
|
30
|
+
routePath = pathname.replace(basename, "");
|
|
31
|
+
}
|
|
28
32
|
const currentRouteKey = Object.keys(routes).find(
|
|
29
|
-
(v) => routes[v].path ===
|
|
33
|
+
(v) => routes[v].path === routePath
|
|
30
34
|
);
|
|
31
35
|
if (!currentRouteKey || routes[currentRouteKey].redirect) {
|
|
32
36
|
return;
|