@xingtukeji/micro 1.1.6 → 1.1.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.
- package/dist/index.js +14 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
var U = Object.defineProperty, A = Object.defineProperties;
|
|
3
3
|
var L = Object.getOwnPropertyDescriptors;
|
|
4
4
|
var g = Object.getOwnPropertySymbols;
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var b = Object.prototype.hasOwnProperty, T = Object.prototype.propertyIsEnumerable;
|
|
6
|
+
var y = (e, t, n) => t in e ? U(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, d = (e, t) => {
|
|
7
7
|
for (var n in t || (t = {}))
|
|
8
|
-
|
|
8
|
+
b.call(t, n) && y(e, n, t[n]);
|
|
9
9
|
if (g)
|
|
10
10
|
for (var n of g(t))
|
|
11
|
-
|
|
11
|
+
T.call(t, n) && y(e, n, t[n]);
|
|
12
12
|
return e;
|
|
13
13
|
}, m = (e, t) => A(e, L(t));
|
|
14
|
-
var u = (e, t, n) => (
|
|
14
|
+
var u = (e, t, n) => (y(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
15
15
|
var I = (e, t, n) => new Promise((r, o) => {
|
|
16
16
|
var s = (l) => {
|
|
17
17
|
try {
|
|
@@ -28,7 +28,7 @@ var I = (e, t, n) => new Promise((r, o) => {
|
|
|
28
28
|
}, i = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(s, a);
|
|
29
29
|
i((n = n.apply(e, t)).next());
|
|
30
30
|
});
|
|
31
|
-
import { ref as P, defineComponent as v, watch as x, onMounted as
|
|
31
|
+
import { ref as P, defineComponent as v, watch as x, onMounted as k, onUnmounted as X, openBlock as $, createElementBlock as H, mergeProps as N } from "vue";
|
|
32
32
|
const c = {
|
|
33
33
|
KEY: "$xtm",
|
|
34
34
|
// 父应用注入子应用实例的key
|
|
@@ -95,7 +95,7 @@ Object.defineProperty(window, c.IS_MICRO, {
|
|
|
95
95
|
M.value = e;
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
|
-
const
|
|
98
|
+
const w = (e) => `${c.DOM_ID_PREFIX}${e}`, K = (e) => {
|
|
99
99
|
function t(i) {
|
|
100
100
|
return i !== null && typeof i == "object" && !Array.isArray(i);
|
|
101
101
|
}
|
|
@@ -125,12 +125,9 @@ const y = (e) => `${c.DOM_ID_PREFIX}${e}`, K = (e) => {
|
|
|
125
125
|
}, 500);
|
|
126
126
|
}, q = (e) => {
|
|
127
127
|
const t = document.createElement("iframe");
|
|
128
|
-
t.id =
|
|
128
|
+
t.id = w(e.app.name);
|
|
129
129
|
const n = K(e.app);
|
|
130
|
-
t.src = n, t.style.width = "100%", t.style.height = "100%", t.style.border = "none", t.style.margin = "0", t.style.padding = "0", t.addEventListener(
|
|
131
|
-
"load",
|
|
132
|
-
(o) => e.onLoad.call(e, o)
|
|
133
|
-
), t.addEventListener(
|
|
130
|
+
t.src = n, t.style.width = "100%", t.style.height = "100%", t.style.border = "none", t.style.margin = "0", t.style.padding = "0", t.style.backgroundColor = "transparent", t.style.visibility = "hidden", t.addEventListener("load", (o) => (t.style.visibility = "visible", e.onLoad.call(e, o))), t.addEventListener(
|
|
134
131
|
"error",
|
|
135
132
|
(o) => e.onError.call(e, o)
|
|
136
133
|
), t.addEventListener(
|
|
@@ -157,7 +154,7 @@ class z {
|
|
|
157
154
|
let r;
|
|
158
155
|
if (t ? (typeof t == "string" ? r = document.querySelector(t) : r = t, r.innerHTML = "") : r = document.body, r) {
|
|
159
156
|
this.panel = r;
|
|
160
|
-
let o = document.getElementById(
|
|
157
|
+
let o = document.getElementById(w(this.app.name));
|
|
161
158
|
o || (o = q(this), this.dom = o), n ? o.style.display = "none" : o.style.removeProperty("display");
|
|
162
159
|
const s = D();
|
|
163
160
|
this.loadingTimer = setTimeout(() => {
|
|
@@ -168,7 +165,7 @@ class z {
|
|
|
168
165
|
}
|
|
169
166
|
unmount() {
|
|
170
167
|
var n;
|
|
171
|
-
const t = document.getElementById(
|
|
168
|
+
const t = document.getElementById(w(this.app.name));
|
|
172
169
|
if (t)
|
|
173
170
|
this.app.preload ? (t.style.display = "none", document.body.appendChild(t)) : (n = this.panel) == null || n.removeChild(t);
|
|
174
171
|
else
|
|
@@ -332,11 +329,11 @@ const J = {
|
|
|
332
329
|
};
|
|
333
330
|
return x(() => t.appId, (o, s) => {
|
|
334
331
|
o !== s && s && ee(s), r();
|
|
335
|
-
}),
|
|
332
|
+
}), k(() => {
|
|
336
333
|
r();
|
|
337
|
-
}),
|
|
334
|
+
}), X(() => {
|
|
338
335
|
console.debug("app unmount", t.appId);
|
|
339
|
-
}), (o, s) => (
|
|
336
|
+
}), (o, s) => ($(), H("div", N({
|
|
340
337
|
ref_key: "refPanel",
|
|
341
338
|
ref: n
|
|
342
339
|
}, o.$attrs, { class: "xt-micro" }), null, 16));
|