@zfqh/uniapp 0.2.5 → 0.2.7
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 +16 -0
- package/lib/mixins/webview.d.ts +8 -0
- package/lib/mixins/webview.js +30 -6
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.7](http://10.10.10.16/caoben/front-end/compare/@zfqh/uniapp@0.2.6...@zfqh/uniapp@0.2.7) (2026-06-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @zfqh/uniapp
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [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)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @zfqh/uniapp
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [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
23
|
|
|
8
24
|
**Note:** Version bump only for package @zfqh/uniapp
|
package/lib/mixins/webview.d.ts
CHANGED
package/lib/mixins/webview.js
CHANGED
|
@@ -8,7 +8,9 @@ import link from '../configs/link';
|
|
|
8
8
|
import path from '../configs/path';
|
|
9
9
|
import { base64ToPath } from '../utils/file';
|
|
10
10
|
import query from '../utils/query';
|
|
11
|
+
import show from './show';
|
|
11
12
|
export default {
|
|
13
|
+
mixins: [show],
|
|
12
14
|
data() {
|
|
13
15
|
return {
|
|
14
16
|
shareData: {},
|
|
@@ -131,8 +133,11 @@ export default {
|
|
|
131
133
|
try {
|
|
132
134
|
if (!this.__webView) {
|
|
133
135
|
// #ifdef H5
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
let ele = this.$el;
|
|
137
|
+
if (ele.tagName !== 'IFRAME') {
|
|
138
|
+
ele = this.$el.querySelector?.('iframe') || document.querySelector('iframe');
|
|
139
|
+
}
|
|
140
|
+
this.__webView = ele?.contentWindow;
|
|
136
141
|
this.__postMessage = (data) => {
|
|
137
142
|
this.__webView?.postMessage({ type: 'WEBVIEW_MESSAGE', data }, '*');
|
|
138
143
|
};
|
|
@@ -220,12 +225,31 @@ export default {
|
|
|
220
225
|
// #ifdef H5
|
|
221
226
|
if (!IS_WEBVIEW_ENV) {
|
|
222
227
|
this.__onWindowMessage = (e) => {
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
228
|
+
if (this.pageShow) {
|
|
229
|
+
try {
|
|
230
|
+
if (e.data.type === 'WEBVIEW_APP_MESSAGE') {
|
|
231
|
+
this.onMessage({ detail: { data: [e.data.data] } });
|
|
232
|
+
}
|
|
233
|
+
else if (e.data.type === 'WEB_INVOKE_APPSERVICE') {
|
|
234
|
+
// webview页面自定义iframe,嵌套页面中调用uni.webView[xx](),必须实现如下功能,否则无效
|
|
235
|
+
if (this.__iframe == null) {
|
|
236
|
+
if (this.$el.tagName === 'IFRAME' || this.$el.querySelector?.('iframe')) {
|
|
237
|
+
this.__iframe = true;
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
this.__iframe = false;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
if (this.__iframe) {
|
|
244
|
+
const { name, arg } = e.data.data || {};
|
|
245
|
+
if (['navigateTo', 'redirectTo', 'reLaunch', 'switchTab', 'navigateBack'].includes(name)) {
|
|
246
|
+
uni[name](arg);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
226
250
|
}
|
|
251
|
+
catch (e) { }
|
|
227
252
|
}
|
|
228
|
-
catch (e) { }
|
|
229
253
|
};
|
|
230
254
|
window.addEventListener('message', this.__onWindowMessage);
|
|
231
255
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zfqh/uniapp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
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": "2390fbfc7c075d7d96f7074553234ec0cfc7f669"
|
|
50
50
|
}
|