@skyfox2000/microbase 1.0.7 → 1.0.9
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/lib/index.d.ts
CHANGED
package/lib/microbase.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { deepClone as
|
|
1
|
+
import { deepClone as l } from "@skyfox2000/fapi";
|
|
2
2
|
import { ref as o, markRaw as p, h as a } from "vue";
|
|
3
3
|
import { createRouter as m, createWebHashHistory as d } from "vue-router";
|
|
4
4
|
var v = /* @__PURE__ */ ((e) => (e.Market = "Market", e.Manual = "Manual", e))(v || {}), y = /* @__PURE__ */ ((e) => (e.App = "App", e.MenuApp = "MenuApp", e.Link = "Link", e.Iframe = "Iframe", e))(y || {});
|
|
5
5
|
const r = (e, n) => {
|
|
6
6
|
if (!(!n || !e))
|
|
7
7
|
for (const t in n)
|
|
8
|
-
t in e && typeof e[t] == "object" && typeof n[t] == "object" && !Array.isArray(n[t]) ? r(e[t], n[t]) : e[t] =
|
|
8
|
+
t in e && typeof e[t] == "object" && typeof n[t] == "object" && !Array.isArray(n[t]) ? r(e[t], n[t]) : e[t] = l(n[t]);
|
|
9
9
|
}, P = (...e) => {
|
|
10
10
|
const n = {};
|
|
11
11
|
for (const t of e)
|
|
@@ -13,7 +13,7 @@ const r = (e, n) => {
|
|
|
13
13
|
for (const t of e)
|
|
14
14
|
t != null && t.Query && !n.Query && (n.Query = {}), r(n.Query, t == null ? void 0 : t.Query);
|
|
15
15
|
for (const t of e)
|
|
16
|
-
n.Data = t != null && t.Data ?
|
|
16
|
+
n.Data = t != null && t.Data ? l(t.Data) : {};
|
|
17
17
|
return n;
|
|
18
18
|
}, I = () => !!window.__MICRO_APP_ENVIRONMENT__, k = () => !!window.__MICRO_APP_BASE_APPLICATION__, i = o(), A = o(), M = o(), R = () => {
|
|
19
19
|
const e = window.microApp.getData(
|
|
@@ -26,11 +26,11 @@ const r = (e, n) => {
|
|
|
26
26
|
name: "默认页面",
|
|
27
27
|
component: () => import("./assets/modules/index-DQ8DfP_z.js")
|
|
28
28
|
}
|
|
29
|
-
],
|
|
29
|
+
], u = m({
|
|
30
30
|
history: d(void 0),
|
|
31
31
|
routes: w
|
|
32
32
|
});
|
|
33
|
-
|
|
33
|
+
u.afterEach((e) => {
|
|
34
34
|
if (i.value) {
|
|
35
35
|
const { mainAppPush: n } = i.value;
|
|
36
36
|
n && n(e.hash);
|
|
@@ -41,7 +41,7 @@ const C = o({}), c = o(""), f = o({}), s = o(null), _ = async (e) => {
|
|
|
41
41
|
const n = f.value[`./views/${e}.vue`];
|
|
42
42
|
if (n) {
|
|
43
43
|
const t = await n();
|
|
44
|
-
s.value = p(t.default),
|
|
44
|
+
s.value = p(t.default), u.replace("/" + e);
|
|
45
45
|
} else
|
|
46
46
|
console.error("加载微模块" + e + "失败"), s.value = a(
|
|
47
47
|
"div",
|
|
@@ -62,13 +62,13 @@ const C = o({}), c = o(""), f = o({}), s = o(null), _ = async (e) => {
|
|
|
62
62
|
f.value = e, window.microApp && window.microApp.addDataListener(async (n) => {
|
|
63
63
|
if (n.pageUrl === c.value) return;
|
|
64
64
|
let t = n.pageUrl;
|
|
65
|
-
_(t);
|
|
65
|
+
t ? _(t) : console.error("微模块地址为空");
|
|
66
66
|
}, !0);
|
|
67
67
|
};
|
|
68
68
|
export {
|
|
69
69
|
y as AppAction,
|
|
70
70
|
v as AppSource,
|
|
71
|
-
|
|
71
|
+
u as LoaderRouter,
|
|
72
72
|
P as combineParams,
|
|
73
73
|
R as initMainAppData,
|
|
74
74
|
E as initModuleLoader,
|
package/package.json
CHANGED
|
@@ -64,7 +64,8 @@ export const initModuleLoader = (
|
|
|
64
64
|
window.microApp.addDataListener(async (data: MainAppData) => {
|
|
65
65
|
if (data.pageUrl === moduleUrl.value) return;
|
|
66
66
|
let page = data.pageUrl as string;
|
|
67
|
-
loadModule(page);
|
|
67
|
+
if (page) loadModule(page);
|
|
68
|
+
else console.error("微模块地址为空");
|
|
68
69
|
}, true);
|
|
69
70
|
}
|
|
70
71
|
};
|
package/src/utils/micro-app.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { HostInfo } from "@/stores/hostInfo";
|
|
|
2
2
|
import { SettingInfo } from "@/stores/settingInfo";
|
|
3
3
|
import { LoginInfo, UserInfo } from "@/stores/userInfo";
|
|
4
4
|
import { ApiResponse } from "@skyfox2000/fapi";
|
|
5
|
-
import { ref } from "vue";
|
|
5
|
+
import { Ref, ref } from "vue";
|
|
6
6
|
/**
|
|
7
7
|
* 是否微服务运行环境
|
|
8
8
|
* @returns
|
|
@@ -66,6 +66,10 @@ export interface MainOpenApis {
|
|
|
66
66
|
* @returns 授权码
|
|
67
67
|
*/
|
|
68
68
|
getToken: () => string;
|
|
69
|
+
/**
|
|
70
|
+
* 主机解析图标库并同步到子应用
|
|
71
|
+
*/
|
|
72
|
+
parseIconLib: (monoColor:boolean, iconLib: Ref<Record<string, any>>) => void;
|
|
69
73
|
/**
|
|
70
74
|
* 获取当前用户信息
|
|
71
75
|
*/
|