@dcloudio/uni-quickapp-webview 2.0.2-3071120230427001 → 2.0.2-3080420230530001

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -8
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -102,7 +102,7 @@ function hasOwn (obj, key) {
102
102
  return hasOwnProperty.call(obj, key)
103
103
  }
104
104
 
105
- function noop () { }
105
+ function noop () {}
106
106
 
107
107
  /**
108
108
  * Create a cached version of a pure function.
@@ -202,9 +202,9 @@ function removeInterceptor (method, option) {
202
202
  }
203
203
  }
204
204
 
205
- function wrapperHook (hook) {
205
+ function wrapperHook (hook, params) {
206
206
  return function (data) {
207
- return hook(data) || data
207
+ return hook(data, params) || data
208
208
  }
209
209
  }
210
210
 
@@ -212,14 +212,14 @@ function isPromise (obj) {
212
212
  return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function'
213
213
  }
214
214
 
215
- function queue (hooks, data) {
215
+ function queue (hooks, data, params) {
216
216
  let promise = false;
217
217
  for (let i = 0; i < hooks.length; i++) {
218
218
  const hook = hooks[i];
219
219
  if (promise) {
220
- promise = Promise.resolve(wrapperHook(hook));
220
+ promise = Promise.resolve(wrapperHook(hook, params));
221
221
  } else {
222
- const res = hook(data);
222
+ const res = hook(data, params);
223
223
  if (isPromise(res)) {
224
224
  promise = Promise.resolve(res);
225
225
  }
@@ -242,7 +242,7 @@ function wrapperOptions (interceptor, options = {}) {
242
242
  if (Array.isArray(interceptor[name])) {
243
243
  const oldCallback = options[name];
244
244
  options[name] = function callbackInterceptor (res) {
245
- queue(interceptor[name], res).then((res) => {
245
+ queue(interceptor[name], res, options).then((res) => {
246
246
  /* eslint-disable no-mixed-operators */
247
247
  return isFn(oldCallback) && oldCallback(res) || res
248
248
  });
@@ -291,7 +291,11 @@ function invokeApi (method, api, options, ...params) {
291
291
  if (Array.isArray(interceptor.invoke)) {
292
292
  const res = queue(interceptor.invoke, options);
293
293
  return res.then((options) => {
294
- return api(wrapperOptions(interceptor, options), ...params)
294
+ // 重新访问 getApiInterceptorHooks, 允许 invoke 中再次调用 addInterceptor,removeInterceptor
295
+ return api(
296
+ wrapperOptions(getApiInterceptorHooks(method), options),
297
+ ...params
298
+ )
295
299
  })
296
300
  } else {
297
301
  return api(wrapperOptions(interceptor, options), ...params)
@@ -2280,6 +2284,7 @@ function parseBaseComponent (vueComponentOptions, {
2280
2284
 
2281
2285
  const options = {
2282
2286
  multipleSlots: true,
2287
+ // styleIsolation: 'apply-shared',
2283
2288
  addGlobalClass: true,
2284
2289
  ...(vueOptions.options || {})
2285
2290
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-quickapp-webview",
3
- "version": "2.0.2-3071120230427001",
3
+ "version": "2.0.2-3080420230530001",
4
4
  "description": "uni-app quickapp-webview",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -17,5 +17,5 @@
17
17
  "name": "quickapp-webview",
18
18
  "title": "快应用(Webview)版"
19
19
  },
20
- "gitHead": "9eec36832c08c90ba3c80bc9021768487b79a8ea"
20
+ "gitHead": "a7f9b00100b54f72f05ad00205f98a5353bd7a4c"
21
21
  }