@dcloudio/uni-quickapp-webview 2.0.1-33520211229002 → 2.0.1-33920220121003

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 +10 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -870,9 +870,15 @@ const customize = cached((str) => {
870
870
 
871
871
  function initTriggerEvent (mpInstance) {
872
872
  const oldTriggerEvent = mpInstance.triggerEvent;
873
- mpInstance.triggerEvent = function (event, ...args) {
873
+ const newTriggerEvent = function (event, ...args) {
874
874
  return oldTriggerEvent.apply(mpInstance, [customize(event), ...args])
875
875
  };
876
+ try {
877
+ // 京东小程序 triggerEvent 为只读
878
+ mpInstance.triggerEvent = newTriggerEvent;
879
+ } catch (error) {
880
+ mpInstance._triggerEvent = newTriggerEvent;
881
+ }
876
882
  }
877
883
 
878
884
  function initHook (name, options, isComponent) {
@@ -2088,17 +2094,17 @@ function createPlugin (vm) {
2088
2094
  const appOptions = parseApp(vm);
2089
2095
  if (isFn(appOptions.onShow) && qa.onAppShow) {
2090
2096
  qa.onAppShow((...args) => {
2091
- appOptions.onShow.apply(vm, args);
2097
+ vm.__call_hook('onShow', args);
2092
2098
  });
2093
2099
  }
2094
2100
  if (isFn(appOptions.onHide) && qa.onAppHide) {
2095
2101
  qa.onAppHide((...args) => {
2096
- appOptions.onHide.apply(vm, args);
2102
+ vm.__call_hook('onHide', args);
2097
2103
  });
2098
2104
  }
2099
2105
  if (isFn(appOptions.onLaunch)) {
2100
2106
  const args = qa.getLaunchOptionsSync && qa.getLaunchOptionsSync();
2101
- appOptions.onLaunch.call(vm, args);
2107
+ vm.__call_hook('onLaunch', args);
2102
2108
  }
2103
2109
  return vm
2104
2110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-quickapp-webview",
3
- "version": "2.0.1-33520211229002",
3
+ "version": "2.0.1-33920220121003",
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": "ebe154e13c5b7c5b015a6c31676ddc3ca2f5cc68"
20
+ "gitHead": "56e678aff7260517a4e93d66ae9dd4489f5db604"
21
21
  }