@airpower/web 1.10.16 → 1.11.1
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/main.js +2 -32
- package/dist/router/RouterUtil.d.ts +1 -8
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -19275,15 +19275,13 @@ class RouterUtil {
|
|
|
19275
19275
|
* @param components 组件列表
|
|
19276
19276
|
* @param componentsDirectory `可选` 组件目录 默认 `/src/view`
|
|
19277
19277
|
* @param parentRouter `可选` 父级路由 默认 `admin`
|
|
19278
|
-
* @param menuCacheKey `可选` 缓存Key 默认 `AirPowerMenuList`
|
|
19279
19278
|
*/
|
|
19280
|
-
static initVueRouter(menuList, components = {}, componentsDirectory = "/src/view", parentRouter = "admin"
|
|
19279
|
+
static async initVueRouter(menuList, components = {}, componentsDirectory = "/src/view", parentRouter = "admin") {
|
|
19281
19280
|
this.components = components;
|
|
19282
19281
|
this.componentsDirectory = componentsDirectory;
|
|
19283
|
-
localStorage.setItem(menuCacheKey, JSON.stringify(menuList));
|
|
19284
19282
|
if (!WebConfig.isTimeout) {
|
|
19285
19283
|
this.registerRoute(menuList, parentRouter);
|
|
19286
|
-
this.
|
|
19284
|
+
await this.router.replace(this.router.currentRoute.value.fullPath);
|
|
19287
19285
|
}
|
|
19288
19286
|
}
|
|
19289
19287
|
/**
|
|
@@ -19373,34 +19371,6 @@ class RouterUtil {
|
|
|
19373
19371
|
this.router.addRoute(parentRouter, route);
|
|
19374
19372
|
}
|
|
19375
19373
|
}
|
|
19376
|
-
/**
|
|
19377
|
-
* ### 重载缓存中的路由
|
|
19378
|
-
* @param menuCacheKey 提供缓存的Key
|
|
19379
|
-
* @param menuList `可选 子菜单,好兄弟,你不用传`
|
|
19380
|
-
*/
|
|
19381
|
-
static reloadCacheMenuList(menuCacheKey, menuList) {
|
|
19382
|
-
if (!this.router) {
|
|
19383
|
-
return;
|
|
19384
|
-
}
|
|
19385
|
-
if (!menuList && localStorage.getItem(menuCacheKey)) {
|
|
19386
|
-
menuList = JSON.parse(localStorage.getItem(menuCacheKey) || "[]");
|
|
19387
|
-
}
|
|
19388
|
-
if (menuList === void 0) {
|
|
19389
|
-
return;
|
|
19390
|
-
}
|
|
19391
|
-
for (const item of menuList) {
|
|
19392
|
-
if (item.children && item.children.length > 0) {
|
|
19393
|
-
this.reloadCacheMenuList(menuCacheKey, item.children);
|
|
19394
|
-
continue;
|
|
19395
|
-
}
|
|
19396
|
-
const locationPathName = window.location.pathname;
|
|
19397
|
-
if (item.path === locationPathName) {
|
|
19398
|
-
localStorage.removeItem(menuCacheKey);
|
|
19399
|
-
this.router.replace(locationPathName + window.location.search);
|
|
19400
|
-
break;
|
|
19401
|
-
}
|
|
19402
|
-
}
|
|
19403
|
-
}
|
|
19404
19374
|
}
|
|
19405
19375
|
class AbstractService extends RootModel {
|
|
19406
19376
|
/**
|
|
@@ -24,9 +24,8 @@ export declare class RouterUtil {
|
|
|
24
24
|
* @param components 组件列表
|
|
25
25
|
* @param componentsDirectory `可选` 组件目录 默认 `/src/view`
|
|
26
26
|
* @param parentRouter `可选` 父级路由 默认 `admin`
|
|
27
|
-
* @param menuCacheKey `可选` 缓存Key 默认 `AirPowerMenuList`
|
|
28
27
|
*/
|
|
29
|
-
static initVueRouter(menuList: Array<IMenu & RootEntity>, components?: Record<string, () => Promise<unknown>>, componentsDirectory?: string, parentRouter?: string
|
|
28
|
+
static initVueRouter(menuList: Array<IMenu & RootEntity>, components?: Record<string, () => Promise<unknown>>, componentsDirectory?: string, parentRouter?: string): Promise<void>;
|
|
30
29
|
/**
|
|
31
30
|
* ### 创建 `Vue` 路由实例
|
|
32
31
|
* @param routes 路由配置文件
|
|
@@ -46,10 +45,4 @@ export declare class RouterUtil {
|
|
|
46
45
|
* @param componentPath 组件路径
|
|
47
46
|
*/
|
|
48
47
|
private static addRoute;
|
|
49
|
-
/**
|
|
50
|
-
* ### 重载缓存中的路由
|
|
51
|
-
* @param menuCacheKey 提供缓存的Key
|
|
52
|
-
* @param menuList `可选 子菜单,好兄弟,你不用传`
|
|
53
|
-
*/
|
|
54
|
-
private static reloadCacheMenuList;
|
|
55
48
|
}
|