react-iframe-plugin 0.0.17 → 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 CHANGED
@@ -1,19 +1,31 @@
1
1
  # IframePlugin
2
2
 
3
- npm i react-iframe-plugin
3
+ Install `node_modules`:
4
4
 
5
+ ```bash
6
+ npm i react-iframe-plugin
7
+ ```
8
+ ```bash
5
9
  or yarn add react-iframe-plugin
10
+ ```
11
+ ```bash
12
+ or pnpm i react-iframe-plugin
13
+ ```
6
14
 
7
- or pnpm i eact-iframe-plugin
8
-
15
+ ```bash
9
16
  - import IframePlugin from 'react-iframe-plugin';
17
+ ```
18
+ ```bash
10
19
  - <IframePlugin
11
20
  currentDomain="http://localhost:3000" //當前domain
12
- iframeDomain="https://amcm.staging.wizmacau.com" //加載domain
13
- src="https://amcm.staging.wizmacau.com/zh-hant/header" //加載地址
14
- url="https://amcm.staging.wizmacau.com" //點擊跳轉地址
21
+ iframeDomain="https://xxxxxxxxxxx.com" //加載domain
22
+ src="https://xxxxxxxxxx.com/zh-hant/header" //加載地址
23
+ url="https://xxxxxxxxxx.com" //點擊跳轉地址
15
24
  basicHeight="250px" //初始高度
16
25
  height="800px" //展開高度
17
26
  width="100%" //寬度
27
+ zIndex="999" //層級
28
+ footerHeight="750px" //底部高度
18
29
  />
30
+ ```
19
31
 
@@ -11,6 +11,7 @@ interface IframePluginProps {
11
11
  url: string;
12
12
  newWindow: boolean;
13
13
  footerHeight: string;
14
+ zIndex: string;
14
15
  }
15
16
  declare const IframePlugin: React.FC<IframePluginProps>;
16
17
  export default IframePlugin;
@@ -1,54 +1,51 @@
1
- import { jsx as n, Fragment as w, jsxs as b } from "react/jsx-runtime";
2
- import { useState as x, useEffect as y } from "react";
3
- const v = (g) => {
4
- const [l, s] = x(""), { footerHeight: f, newWindow: d, url: h, basicHeight: t, iframeDomain: r, currentDomain: e, types: p, src: c, title: m, width: u, height: o } = g;
5
- return y(
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 a = document.getElementById("iframePlugin");
8
- console.log(87878787, a.contentWindow, e, r, h, o, t, d), a.addEventListener("load", function() {
9
- console.log("currentDomain────────────", e, t), s(t || "250px"), e && a.contentWindow.postMessage(
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: h || "http://localhost:8081",
14
- height: o || "800px",
13
+ url: d || "http://localhost:8081",
14
+ height: a || "800px",
15
15
  basicHeight: t,
16
- newWindow: d || !0
16
+ newWindow: h || !0
17
17
  },
18
18
  r || "http://localhost:8086"
19
19
  );
20
- }), window.addEventListener("message", function(i) {
21
- console.log(123123123123, i), console.log("Fetch iframe:", i.data.height), i.data && s(i.data.height);
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__ */ n(w, { children: /* @__PURE__ */ b("div", { style: { width: "100%", position: "relative", paddingBottom: "250px" }, children: [
26
- /* @__PURE__ */ n("div", { style: { position: "absolute", left: "30%", top: 0, color: "white" }, children: l }),
27
- p === "footer" ? /* @__PURE__ */ n(
28
- "iframe",
29
- {
30
- id: "iframeFooter",
31
- src: c,
32
- title: m,
33
- width: u,
34
- height: o,
35
- style: { border: "none", height: f, width: "100vw", background: "transparent", position: "absolute" },
36
- allowFullScreen: !0
37
- }
38
- ) : /* @__PURE__ */ n(
39
- "iframe",
40
- {
41
- id: "iframePlugin",
42
- src: c,
43
- title: m,
44
- width: u,
45
- height: o,
46
- style: { border: "none", height: l, width: "100vw", background: "transparent", position: "absolute" },
47
- allowFullScreen: !0
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
- v as default
50
+ E as default
54
51
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-iframe-plugin",
3
3
  "private": false,
4
- "version": "0.0.17",
4
+ "version": "0.0.19",
5
5
  "scripts": {
6
6
  "dev": "vite",
7
7
  "lint": "eslint .",