@skyfox2000/microbase 1.0.7 → 1.0.8

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.
@@ -1,11 +1,11 @@
1
- import { deepClone as u } from "@skyfox2000/fapi";
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] = u(n[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 ? u(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
- ], l = m({
29
+ ], u = m({
30
30
  history: d(void 0),
31
31
  routes: w
32
32
  });
33
- l.afterEach((e) => {
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), l.replace("/" + e);
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
- l as LoaderRouter,
71
+ u as LoaderRouter,
72
72
  P as combineParams,
73
73
  R as initMainAppData,
74
74
  E as initModuleLoader,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyfox2000/microbase",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "微前端通用功能与数据类型定义",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -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
  };