@zfqh/uniapp 0.2.5 → 0.2.6
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/CHANGELOG.md +8 -0
- package/lib/mixins/webview.js +22 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.2.6](http://10.10.10.16/caoben/front-end/compare/@zfqh/uniapp@0.2.5...@zfqh/uniapp@0.2.6) (2026-06-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @zfqh/uniapp
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [0.2.5](http://10.10.10.16/caoben/front-end/compare/@zfqh/uniapp@0.2.4...@zfqh/uniapp@0.2.5) (2026-06-23)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @zfqh/uniapp
|
package/lib/mixins/webview.js
CHANGED
|
@@ -131,8 +131,11 @@ export default {
|
|
|
131
131
|
try {
|
|
132
132
|
if (!this.__webView) {
|
|
133
133
|
// #ifdef H5
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
let ele = this.$el;
|
|
135
|
+
if (ele.tagName !== 'IFRAME') {
|
|
136
|
+
ele = this.$el.querySelector?.('iframe') || document.querySelector('iframe');
|
|
137
|
+
}
|
|
138
|
+
this.__webView = ele?.contentWindow;
|
|
136
139
|
this.__postMessage = (data) => {
|
|
137
140
|
this.__webView?.postMessage({ type: 'WEBVIEW_MESSAGE', data }, '*');
|
|
138
141
|
};
|
|
@@ -224,6 +227,23 @@ export default {
|
|
|
224
227
|
if (e.data.type === 'WEBVIEW_APP_MESSAGE') {
|
|
225
228
|
this.onMessage({ detail: { data: [e.data.data] } });
|
|
226
229
|
}
|
|
230
|
+
else if (e.data.type === 'WEB_INVOKE_APPSERVICE') {
|
|
231
|
+
// webview页面自定义iframe,嵌套页面中调用uni.webView[xx](),必须实现如下功能,否则无效
|
|
232
|
+
if (this.__iframe == null) {
|
|
233
|
+
if (this.$el.tagName === 'IFRAME' || this.$el.querySelector?.('iframe')) {
|
|
234
|
+
this.__iframe = true;
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
this.__iframe = false;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
if (this.__iframe) {
|
|
241
|
+
const { name, arg } = e.data.data || {};
|
|
242
|
+
if (['navigateTo', 'redirectTo', 'reLaunch', 'switchTab', 'navigateBack'].includes(name)) {
|
|
243
|
+
uni[name](arg);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
227
247
|
}
|
|
228
248
|
catch (e) { }
|
|
229
249
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zfqh/uniapp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "uniapp公共模块",
|
|
5
5
|
"author": "yinjiazeng@163.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"@types/qs": "^6.9.16",
|
|
47
47
|
"@types/url-parse": "^1.4.11"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "d2abc06f15cf1915b7c24dd3006360a49ab5752c"
|
|
50
50
|
}
|