xctc-utils 1.6.43 → 1.6.44
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/iframe/index.js +11 -5
- package/package.json +1 -1
package/dist/iframe/index.js
CHANGED
|
@@ -70,11 +70,13 @@ function sendDataFormat(data, msg) {
|
|
|
70
70
|
}
|
|
71
71
|
function onloadIframe(id, url, data) {
|
|
72
72
|
if (!id) {
|
|
73
|
-
console.error("
|
|
73
|
+
console.error("onloadIframe:请传入iframe元素的id属性值");
|
|
74
|
+
alert("请传入iframe元素的id属性值");
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
77
|
if (!url) {
|
|
77
78
|
console.error("请传入iframe元素的src属性值");
|
|
79
|
+
alert("onloadIframe:请传入iframe元素的src属性值");
|
|
78
80
|
return;
|
|
79
81
|
}
|
|
80
82
|
var msg = "\u7236\u9875\u9762\u5411\u5B50\u9875\u9762".concat(url, "\u4F20\u9012\u53C2\u6570");
|
|
@@ -83,12 +85,16 @@ function onloadIframe(id, url, data) {
|
|
|
83
85
|
iframe.src = url;
|
|
84
86
|
if (iframe.hasOwnProperty("attachEvent")) {
|
|
85
87
|
iframe.attachEvent('onload', function () {
|
|
86
|
-
|
|
88
|
+
setTimeout(function () {
|
|
89
|
+
iframe.contentWindow.postMessage(sendData, iframe.src);
|
|
90
|
+
}, 0);
|
|
87
91
|
});
|
|
88
92
|
}
|
|
89
93
|
else {
|
|
90
94
|
iframe.onload = function () {
|
|
91
|
-
|
|
95
|
+
setTimeout(function () {
|
|
96
|
+
iframe.contentWindow.postMessage(sendData, iframe.src);
|
|
97
|
+
}, 0);
|
|
92
98
|
};
|
|
93
99
|
}
|
|
94
100
|
}
|
|
@@ -105,8 +111,8 @@ var parentSendIframeData = function (id, data, url, duration) {
|
|
|
105
111
|
console.error("请传入iframe元素的id属性值");
|
|
106
112
|
return;
|
|
107
113
|
}
|
|
108
|
-
if (!
|
|
109
|
-
console.error("
|
|
114
|
+
if (!data) {
|
|
115
|
+
console.error("请传入需要发送到子页面数据");
|
|
110
116
|
return;
|
|
111
117
|
}
|
|
112
118
|
if (!duration)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xctc-utils",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.44",
|
|
4
4
|
"description": "localStorage存储\r ```\r sessionStorage存储\r ```\r crypto-js加密、解密\r ```\r 微信授权登录、微信分享\r ```\r 设备环境获取\r ```\r 是否是微信浏览器\r ```\r 时间戳转时间,字符串转时间戳",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|