react-iframe-plugin 0.0.18 → 0.0.19
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/README.md +3 -1
- package/dist/IframePlugin.d.ts +1 -0
- package/dist/IframePlugin.es.js +37 -40
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ npm i react-iframe-plugin
|
|
|
9
9
|
or yarn add react-iframe-plugin
|
|
10
10
|
```
|
|
11
11
|
```bash
|
|
12
|
-
or pnpm i
|
|
12
|
+
or pnpm i react-iframe-plugin
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
```bash
|
|
@@ -24,6 +24,8 @@ or pnpm i eact-iframe-plugin
|
|
|
24
24
|
basicHeight="250px" //初始高度
|
|
25
25
|
height="800px" //展開高度
|
|
26
26
|
width="100%" //寬度
|
|
27
|
+
zIndex="999" //層級
|
|
28
|
+
footerHeight="750px" //底部高度
|
|
27
29
|
/>
|
|
28
30
|
```
|
|
29
31
|
|
package/dist/IframePlugin.d.ts
CHANGED
package/dist/IframePlugin.es.js
CHANGED
|
@@ -1,54 +1,51 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
const
|
|
4
|
-
const [
|
|
5
|
-
return
|
|
1
|
+
import { jsx as i, Fragment as w } from "react/jsx-runtime";
|
|
2
|
+
import { useState as b, useEffect as x } from "react";
|
|
3
|
+
const E = (u) => {
|
|
4
|
+
const [f, s] = b(""), { zIndex: p, footerHeight: n, newWindow: h, url: d, basicHeight: t, iframeDomain: r, currentDomain: e, types: F, src: c, title: m, width: g, height: a } = u;
|
|
5
|
+
return x(
|
|
6
6
|
() => {
|
|
7
|
-
const
|
|
8
|
-
console.log(87878787,
|
|
9
|
-
console.log("currentDomain────────────", e, t), s(t || "250px"), e &&
|
|
7
|
+
const l = document.getElementById("iframePlugin");
|
|
8
|
+
console.log(87878787, l.contentWindow, e, r, d, a, t, h), l.addEventListener("load", function() {
|
|
9
|
+
console.log("currentDomain────────────", e, t), s(t || "250px"), e && l.contentWindow.postMessage(
|
|
10
10
|
{
|
|
11
11
|
currentDomain: e || "http://localhost:8081",
|
|
12
12
|
iframeDomain: r || "http://localhost:8086",
|
|
13
|
-
url:
|
|
14
|
-
height:
|
|
13
|
+
url: d || "http://localhost:8081",
|
|
14
|
+
height: a || "800px",
|
|
15
15
|
basicHeight: t,
|
|
16
|
-
newWindow:
|
|
16
|
+
newWindow: h || !0
|
|
17
17
|
},
|
|
18
18
|
r || "http://localhost:8086"
|
|
19
19
|
);
|
|
20
|
-
}), window.addEventListener("message", function(
|
|
21
|
-
console.log(123123123123,
|
|
20
|
+
}), window.addEventListener("message", function(o) {
|
|
21
|
+
console.log(123123123123, o), console.log("Fetch iframe:", o.data.height), o.data && s(o.data.height);
|
|
22
22
|
});
|
|
23
23
|
},
|
|
24
24
|
[]
|
|
25
|
-
), /* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
)
|
|
50
|
-
] }) });
|
|
25
|
+
), /* @__PURE__ */ i(w, { children: /* @__PURE__ */ i("div", { style: { width: "100%", position: "relative", paddingBottom: "250px", zIndex: p }, children: n ? /* @__PURE__ */ i(
|
|
26
|
+
"iframe",
|
|
27
|
+
{
|
|
28
|
+
id: "iframeFooter",
|
|
29
|
+
src: c,
|
|
30
|
+
title: m,
|
|
31
|
+
width: g,
|
|
32
|
+
height: n,
|
|
33
|
+
style: { border: "none", height: n, width: "100vw", background: "transparent", position: "absolute" },
|
|
34
|
+
allowFullScreen: !0
|
|
35
|
+
}
|
|
36
|
+
) : /* @__PURE__ */ i(
|
|
37
|
+
"iframe",
|
|
38
|
+
{
|
|
39
|
+
id: "iframePlugin",
|
|
40
|
+
src: c,
|
|
41
|
+
title: m,
|
|
42
|
+
width: g,
|
|
43
|
+
height: a,
|
|
44
|
+
style: { border: "none", height: f, width: "100vw", background: "transparent", position: "absolute" },
|
|
45
|
+
allowFullScreen: !0
|
|
46
|
+
}
|
|
47
|
+
) }) });
|
|
51
48
|
};
|
|
52
49
|
export {
|
|
53
|
-
|
|
50
|
+
E as default
|
|
54
51
|
};
|