@dcloudio/vue-cli-plugin-uni 2.0.2-alpha-5010320260611001 → 2.0.2-alpha-5020120260710001

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/vue-cli-plugin-uni",
3
- "version": "2.0.2-alpha-5010320260611001",
3
+ "version": "2.0.2-alpha-5020120260710001",
4
4
  "description": "uni-app plugin for vue-cli 3",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -17,7 +17,7 @@
17
17
  "author": "fxy060608",
18
18
  "license": "Apache-2.0",
19
19
  "dependencies": {
20
- "@dcloudio/uni-stat": "^2.0.2-alpha-5010320260611001",
20
+ "@dcloudio/uni-stat": "^2.0.2-alpha-5020120260710001",
21
21
  "buffer-json": "^2.0.0",
22
22
  "clone-deep": "^4.0.1",
23
23
  "cross-env": "^5.2.0",
@@ -41,5 +41,5 @@
41
41
  "copy-webpack-plugin": ">=5",
42
42
  "postcss": ">=7"
43
43
  },
44
- "gitHead": "4bd2647dc8989047700b1643a943316144b1befa"
44
+ "gitHead": "cf7b7801e8bc5a7e8b9cac638f4e3bece2599e42"
45
45
  }
@@ -2231,17 +2231,17 @@ function updateListeners (
2231
2231
 
2232
2232
  /* */
2233
2233
 
2234
- // fixed by xxxxxx (mp properties)
2235
- function extractPropertiesFromVNodeData(data, Ctor, res, context) {
2236
- var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
2237
- if (isUndef(propOptions)) {
2238
- return res
2234
+ // fixed by xxxxxx (mp properties)
2235
+ function extractPropertiesFromVNodeData(data, Ctor, res, context) {
2236
+ var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties;
2237
+ if (isUndef(propOptions)) {
2238
+ return res
2239
2239
  }
2240
- var externalClasses = Ctor.options.mpOptions.externalClasses || [];
2240
+ var externalClasses = Ctor.options.mpOptions.externalClasses || [];
2241
2241
  var attrs = data.attrs;
2242
- var props = data.props;
2243
- if (isDef(attrs) || isDef(props)) {
2244
- for (var key in propOptions) {
2242
+ var props = data.props;
2243
+ if (isDef(attrs) || isDef(props)) {
2244
+ for (var key in propOptions) {
2245
2245
  var altKey = hyphenate(key);
2246
2246
  var result = checkProp(res, props, key, altKey, true) ||
2247
2247
  checkProp(res, attrs, key, altKey, false);
@@ -2254,10 +2254,10 @@ function extractPropertiesFromVNodeData(data, Ctor, res, context) {
2254
2254
  ) {
2255
2255
  // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串)
2256
2256
  res[key] = context[camelize(res[key])];
2257
- }
2258
- }
2259
- }
2260
- return res
2257
+ }
2258
+ }
2259
+ }
2260
+ return res
2261
2261
  }
2262
2262
 
2263
2263
  function extractPropsFromVNodeData (
@@ -4089,10 +4089,10 @@ function updateChildComponent (
4089
4089
  // keep a copy of raw propsData
4090
4090
  vm.$options.propsData = propsData;
4091
4091
  }
4092
-
4092
+
4093
4093
  // fixed by xxxxxx update properties(mp runtime)
4094
4094
  vm._$updateProperties && vm._$updateProperties(vm);
4095
-
4095
+
4096
4096
  // update listeners
4097
4097
  listeners = listeners || emptyObject;
4098
4098
  var oldListeners = vm.$options._parentListeners;
@@ -4623,7 +4623,7 @@ function initProps (vm, propsOptions) {
4623
4623
  }
4624
4624
  //fixed by xxxxxx __next_tick_pending,uni://form-field 时不告警
4625
4625
  if(
4626
- key === 'value' &&
4626
+ key === 'value' &&
4627
4627
  Array.isArray(vm.$options.behaviors) &&
4628
4628
  vm.$options.behaviors.indexOf('uni://form-field') !== -1
4629
4629
  ){
@@ -4635,7 +4635,7 @@ function initProps (vm, propsOptions) {
4635
4635
  var $parent = vm.$parent;
4636
4636
  while($parent){
4637
4637
  if($parent.__next_tick_pending){
4638
- return
4638
+ return
4639
4639
  }
4640
4640
  $parent = $parent.$parent;
4641
4641
  }
@@ -4967,10 +4967,10 @@ function initMixin (Vue) {
4967
4967
  initEvents(vm);
4968
4968
  initRender(vm);
4969
4969
  callHook(vm, 'beforeCreate');
4970
- !vm._$fallback && initInjections(vm); // resolve injections before data/props
4970
+ !vm._$fallback && initInjections(vm); // resolve injections before data/props
4971
4971
  initState(vm);
4972
4972
  !vm._$fallback && initProvide(vm); // resolve provide after data/props
4973
- !vm._$fallback && callHook(vm, 'created');
4973
+ !vm._$fallback && callHook(vm, 'created');
4974
4974
 
4975
4975
  /* istanbul ignore if */
4976
4976
  if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
@@ -5459,7 +5459,7 @@ function syncKeys(current, pre) {
5459
5459
 
5460
5460
  function nullOrUndefined(currentType, preType) {
5461
5461
  if(
5462
- (currentType === NULLTYPE || currentType === UNDEFINEDTYPE) &&
5462
+ (currentType === NULLTYPE || currentType === UNDEFINEDTYPE) &&
5463
5463
  (preType === NULLTYPE || preType === UNDEFINEDTYPE)
5464
5464
  ) {
5465
5465
  return false
@@ -5548,11 +5548,12 @@ function type(obj) {
5548
5548
  */
5549
5549
 
5550
5550
  function copyBuffer(cur) {
5551
- if (cur instanceof Buffer) {
5551
+ if (typeof Buffer !== 'undefined' && cur instanceof Buffer) {
5552
5552
  return Buffer.from(cur)
5553
5553
  }
5554
5554
 
5555
- return new cur.constructor(cur.buffer.slice(), cur.byteOffset, cur.length)
5555
+ var length = cur instanceof DataView ? cur.byteLength : cur.length;
5556
+ return new cur.constructor(cur.buffer.slice(), cur.byteOffset, length)
5556
5557
  }
5557
5558
 
5558
5559
  /**
@@ -5565,7 +5566,7 @@ function rfdc(opts) {
5565
5566
  if (opts.circles) { return rfdcCircles(opts) }
5566
5567
 
5567
5568
  var constructorHandlers = new Map();
5568
- constructorHandlers.set(Date, function (o) { return new Date(o); });
5569
+ constructorHandlers.set(Date, function (o) { return o.toJSON(); });
5569
5570
  constructorHandlers.set(Map, function (o, fn) { return new Map(cloneArray(Array.from(o), fn)); });
5570
5571
  constructorHandlers.set(Set, function (o, fn) { return new Set(cloneArray(Array.from(o), fn)); });
5571
5572
  if (opts.constructorHandlers) {
@@ -5580,7 +5581,7 @@ function rfdc(opts) {
5580
5581
 
5581
5582
  function cloneArray(a, fn) {
5582
5583
  var keys = Object.keys(a);
5583
- var a2 = new Array(keys.length);
5584
+ var a2 = new Array(a.length);
5584
5585
  for (var i = 0; i < keys.length; i++) {
5585
5586
  var k = keys[i];
5586
5587
  var cur = a[k];
@@ -5591,7 +5592,7 @@ function rfdc(opts) {
5591
5592
  } else if (ArrayBuffer.isView(cur)) {
5592
5593
  a2[k] = copyBuffer(cur);
5593
5594
  } else {
5594
- a2[k] = fn(cur);
5595
+ a2[k] = fn(opts.reviver ? opts.reviver(k, cur) : cur);
5595
5596
  }
5596
5597
  }
5597
5598
  return a2
@@ -5648,7 +5649,7 @@ function rfdcCircles(opts) {
5648
5649
  var refsNew = [];
5649
5650
 
5650
5651
  var constructorHandlers = new Map();
5651
- constructorHandlers.set(Date, function (o) { return new Date(o); });
5652
+ constructorHandlers.set(Date, function (o) { return o.toJSON(); });
5652
5653
  constructorHandlers.set(Map, function (o, fn) { return new Map(cloneArray(Array.from(o), fn)); });
5653
5654
  constructorHandlers.set(Set, function (o, fn) { return new Set(cloneArray(Array.from(o), fn)); });
5654
5655
  if (opts.constructorHandlers) {
@@ -5662,7 +5663,9 @@ function rfdcCircles(opts) {
5662
5663
 
5663
5664
  function cloneArray(a, fn) {
5664
5665
  var keys = Object.keys(a);
5665
- var a2 = new Array(keys.length);
5666
+ var a2 = new Array(a.length);
5667
+ refs.push(a);
5668
+ refsNew.push(a2);
5666
5669
  for (var i = 0; i < keys.length; i++) {
5667
5670
  var k = keys[i];
5668
5671
  var cur = a[k];
@@ -5677,10 +5680,12 @@ function rfdcCircles(opts) {
5677
5680
  if (index !== -1) {
5678
5681
  a2[k] = refsNew[index];
5679
5682
  } else {
5680
- a2[k] = fn(cur);
5683
+ a2[k] = fn(opts.reviver ? opts.reviver(k, cur) : cur);
5681
5684
  }
5682
5685
  }
5683
5686
  }
5687
+ refs.pop();
5688
+ refsNew.pop();
5684
5689
  return a2
5685
5690
  }
5686
5691
 
@@ -5748,150 +5753,150 @@ function rfdcCircles(opts) {
5748
5753
  }
5749
5754
  }
5750
5755
 
5751
- /* */
5752
-
5753
- function flushCallbacks$1(vm) {
5754
- if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
5755
- if (process.env.VUE_APP_DEBUG) {
5756
- var mpInstance = vm.$scope;
5757
- console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
5758
- ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
5759
- }
5760
- var copies = vm.__next_tick_callbacks.slice(0);
5761
- vm.__next_tick_callbacks.length = 0;
5762
- for (var i = 0; i < copies.length; i++) {
5763
- copies[i]();
5764
- }
5765
- }
5766
- }
5767
-
5768
- function hasRenderWatcher(vm) {
5769
- return queue.find(function (watcher) { return vm._watcher === watcher; })
5770
- }
5771
-
5772
- function nextTick$1(vm, cb) {
5773
- //1.nextTick 之前 已 setData 且 setData 还未回调完成
5774
- //2.nextTick 之前存在 render watcher
5756
+ /* */
5757
+
5758
+ function flushCallbacks$1(vm) {
5759
+ if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
5760
+ if (process.env.VUE_APP_DEBUG) {
5761
+ var mpInstance = vm.$scope;
5762
+ console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
5763
+ ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
5764
+ }
5765
+ var copies = vm.__next_tick_callbacks.slice(0);
5766
+ vm.__next_tick_callbacks.length = 0;
5767
+ for (var i = 0; i < copies.length; i++) {
5768
+ copies[i]();
5769
+ }
5770
+ }
5771
+ }
5772
+
5773
+ function hasRenderWatcher(vm) {
5774
+ return queue.find(function (watcher) { return vm._watcher === watcher; })
5775
+ }
5776
+
5777
+ function nextTick$1(vm, cb) {
5778
+ //1.nextTick 之前 已 setData 且 setData 还未回调完成
5779
+ //2.nextTick 之前存在 render watcher
5775
5780
  if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
5776
5781
  if(process.env.VUE_APP_DEBUG){
5777
5782
  var mpInstance = vm.$scope;
5778
5783
  console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
5779
5784
  ']:nextVueTick');
5780
- }
5781
- return nextTick(cb, vm)
5785
+ }
5786
+ return nextTick(cb, vm)
5782
5787
  }else{
5783
5788
  if(process.env.VUE_APP_DEBUG){
5784
5789
  var mpInstance$1 = vm.$scope;
5785
5790
  console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
5786
5791
  ']:nextMPTick');
5787
5792
  }
5788
- }
5789
- var _resolve;
5790
- if (!vm.__next_tick_callbacks) {
5791
- vm.__next_tick_callbacks = [];
5792
- }
5793
- vm.__next_tick_callbacks.push(function () {
5794
- if (cb) {
5795
- try {
5796
- cb.call(vm);
5797
- } catch (e) {
5798
- handleError(e, vm, 'nextTick');
5799
- }
5800
- } else if (_resolve) {
5801
- _resolve(vm);
5802
- }
5803
- });
5804
- // $flow-disable-line
5805
- if (!cb && typeof Promise !== 'undefined') {
5806
- return new Promise(function (resolve) {
5807
- _resolve = resolve;
5808
- })
5809
- }
5810
- }
5811
-
5812
- /* */
5813
-
5814
- function clearInstance(key, value) {
5815
- // 简易去除 Vue 和小程序组件实例
5816
- if (value) {
5817
- if (value._isVue || value.__v_isMPComponent) {
5818
- return {}
5819
- }
5820
- }
5821
- return value
5822
- }
5823
-
5824
- var cloneDeepCircles = rfdc({ circles: true, reviver: clearInstance });
5825
-
5826
- function cloneWithData(vm) {
5827
- // 确保当前 vm 所有数据被同步
5828
- var ret = Object.create(null);
5829
- var dataKeys = [].concat(
5830
- Object.keys(vm._data || {}),
5831
- Object.keys(vm._computedWatchers || {}));
5832
-
5833
- dataKeys.reduce(function(ret, key) {
5834
- ret[key] = vm[key];
5835
- return ret
5836
- }, ret);
5837
-
5838
- // vue-composition-api
5839
- var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
5840
- var rawBindings = compositionApiState && compositionApiState.rawBindings;
5841
- if (rawBindings) {
5842
- Object.keys(rawBindings).forEach(function (key) {
5843
- ret[key] = vm[key];
5844
- });
5845
- }
5846
-
5847
- //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
5848
- Object.assign(ret, vm.$mp.data || {});
5849
- if (
5850
- Array.isArray(vm.$options.behaviors) &&
5851
- vm.$options.behaviors.indexOf('uni://form-field') !== -1
5852
- ) { //form-field
5853
- ret['name'] = vm.name;
5854
- ret['value'] = vm.value;
5855
- }
5856
-
5857
- return cloneDeepCircles(ret)
5858
- }
5859
-
5793
+ }
5794
+ var _resolve;
5795
+ if (!vm.__next_tick_callbacks) {
5796
+ vm.__next_tick_callbacks = [];
5797
+ }
5798
+ vm.__next_tick_callbacks.push(function () {
5799
+ if (cb) {
5800
+ try {
5801
+ cb.call(vm);
5802
+ } catch (e) {
5803
+ handleError(e, vm, 'nextTick');
5804
+ }
5805
+ } else if (_resolve) {
5806
+ _resolve(vm);
5807
+ }
5808
+ });
5809
+ // $flow-disable-line
5810
+ if (!cb && typeof Promise !== 'undefined') {
5811
+ return new Promise(function (resolve) {
5812
+ _resolve = resolve;
5813
+ })
5814
+ }
5815
+ }
5816
+
5817
+ /* */
5818
+
5819
+ function clearInstance(key, value) {
5820
+ // 简易去除 Vue 和小程序组件实例
5821
+ if (value) {
5822
+ if (value._isVue || value.__v_isMPComponent) {
5823
+ return {}
5824
+ }
5825
+ }
5826
+ return value
5827
+ }
5828
+
5829
+ var cloneDeepCircles = rfdc({ circles: true, reviver: clearInstance });
5830
+
5831
+ function cloneWithData(vm) {
5832
+ // 确保当前 vm 所有数据被同步
5833
+ var ret = Object.create(null);
5834
+ var dataKeys = [].concat(
5835
+ Object.keys(vm._data || {}),
5836
+ Object.keys(vm._computedWatchers || {}));
5837
+
5838
+ dataKeys.reduce(function(ret, key) {
5839
+ ret[key] = vm[key];
5840
+ return ret
5841
+ }, ret);
5842
+
5843
+ // vue-composition-api
5844
+ var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
5845
+ var rawBindings = compositionApiState && compositionApiState.rawBindings;
5846
+ if (rawBindings) {
5847
+ Object.keys(rawBindings).forEach(function (key) {
5848
+ ret[key] = vm[key];
5849
+ });
5850
+ }
5851
+
5852
+ //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
5853
+ Object.assign(ret, vm.$mp.data || {});
5854
+ if (
5855
+ Array.isArray(vm.$options.behaviors) &&
5856
+ vm.$options.behaviors.indexOf('uni://form-field') !== -1
5857
+ ) { //form-field
5858
+ ret['name'] = vm.name;
5859
+ ret['value'] = vm.value;
5860
+ }
5861
+
5862
+ return cloneDeepCircles(ret)
5863
+ }
5864
+
5860
5865
  var patch = function(oldVnode, vnode) {
5861
5866
  var this$1 = this;
5862
-
5863
- if (vnode === null) { //destroy
5864
- return
5865
- }
5866
- if (this.mpType === 'page' || this.mpType === 'component') {
5867
- var mpInstance = this.$scope;
5868
- var data = Object.create(null);
5869
- try {
5870
- data = cloneWithData(this);
5871
- } catch (err) {
5872
- console.error(err);
5873
- }
5874
- data.__webviewId__ = mpInstance.data.__webviewId__;
5875
- var mpData = Object.create(null);
5876
- Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
5877
- mpData[key] = mpInstance.data[key];
5878
- });
5879
- var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
5880
- if (Object.keys(diffData).length) {
5881
- if (process.env.VUE_APP_DEBUG) {
5882
- console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
5883
- ']差量更新',
5884
- JSON.stringify(diffData));
5885
- }
5886
- this.__next_tick_pending = true;
5887
- mpInstance.setData(diffData, function () {
5888
- this$1.__next_tick_pending = false;
5889
- flushCallbacks$1(this$1);
5890
- });
5891
- } else {
5892
- flushCallbacks$1(this);
5893
- }
5894
- }
5867
+
5868
+ if (vnode === null) { //destroy
5869
+ return
5870
+ }
5871
+ if (this.mpType === 'page' || this.mpType === 'component') {
5872
+ var mpInstance = this.$scope;
5873
+ var data = Object.create(null);
5874
+ try {
5875
+ data = cloneWithData(this);
5876
+ } catch (err) {
5877
+ console.error(err);
5878
+ }
5879
+ data.__webviewId__ = mpInstance.data.__webviewId__;
5880
+ var mpData = Object.create(null);
5881
+ Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
5882
+ mpData[key] = mpInstance.data[key];
5883
+ });
5884
+ var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
5885
+ if (Object.keys(diffData).length) {
5886
+ if (process.env.VUE_APP_DEBUG) {
5887
+ console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
5888
+ ']差量更新',
5889
+ JSON.stringify(diffData));
5890
+ }
5891
+ this.__next_tick_pending = true;
5892
+ mpInstance.setData(diffData, function () {
5893
+ this$1.__next_tick_pending = false;
5894
+ flushCallbacks$1(this$1);
5895
+ });
5896
+ } else {
5897
+ flushCallbacks$1(this);
5898
+ }
5899
+ }
5895
5900
  };
5896
5901
 
5897
5902
  /* */
@@ -5931,7 +5936,7 @@ function mountComponent$1(
5931
5936
  }
5932
5937
  }
5933
5938
  }
5934
-
5939
+
5935
5940
  !vm._$fallback && callHook(vm, 'beforeMount');
5936
5941
 
5937
5942
  var updateComponent = function () {
@@ -6032,261 +6037,261 @@ function normalizeStyleBinding (bindingStyle) {
6032
6037
  return bindingStyle
6033
6038
  }
6034
6039
 
6035
- /* */
6036
-
6037
- var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
6038
-
6039
- function getTarget(obj, path) {
6040
- var parts = path.split('.');
6041
- var key = parts[0];
6042
- if (key.indexOf('__$n') === 0) { //number index
6043
- key = parseInt(key.replace('__$n', ''));
6044
- }
6045
- if (parts.length === 1) {
6046
- return obj[key]
6047
- }
6048
- return getTarget(obj[key], parts.slice(1).join('.'))
6049
- }
6050
-
6051
- function internalMixin(Vue) {
6052
-
6053
- Vue.config.errorHandler = function(err, vm, info) {
6054
- Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
6055
- console.error(err);
6056
- /* eslint-disable no-undef */
6057
- var app = typeof getApp === 'function' && getApp();
6058
- if (app && app.onError) {
6059
- app.onError(err);
6060
- }
6061
- };
6062
-
6063
- var oldEmit = Vue.prototype.$emit;
6064
-
6065
- Vue.prototype.$emit = function(event) {
6066
- if (this.$scope && event) {
6067
- var triggerEvent = this.$scope['_triggerEvent'] || this.$scope['triggerEvent'];
6068
- if (triggerEvent) {
6069
- try {
6070
- triggerEvent.call(this.$scope, event, {
6071
- __args__: toArray(arguments, 1)
6072
- });
6073
- } catch (error) {
6074
-
6075
- }
6076
- }
6077
- }
6078
- return oldEmit.apply(this, arguments)
6079
- };
6080
-
6081
- Vue.prototype.$nextTick = function(fn) {
6082
- return nextTick$1(this, fn)
6083
- };
6084
-
6085
- MP_METHODS.forEach(function (method) {
6086
- Vue.prototype[method] = function(args) {
6087
- if (this.$scope && this.$scope[method]) {
6088
- return this.$scope[method](args)
6089
- }
6090
- // mp-alipay
6091
- if (typeof my === 'undefined') {
6092
- return
6093
- }
6094
- if (method === 'createSelectorQuery') {
6095
- /* eslint-disable no-undef */
6096
- return my.createSelectorQuery(args)
6097
- } else if (method === 'createIntersectionObserver') {
6098
- /* eslint-disable no-undef */
6099
- return my.createIntersectionObserver(args)
6100
- }
6101
- // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
6102
- };
6103
- });
6104
-
6105
- Vue.prototype.__init_provide = initProvide;
6106
-
6107
- Vue.prototype.__init_injections = initInjections;
6108
-
6109
- Vue.prototype.__call_hook = function(hook, args) {
6110
- var vm = this;
6111
- // #7573 disable dep collection when invoking lifecycle hooks
6112
- pushTarget();
6113
- var handlers = vm.$options[hook];
6114
- var info = hook + " hook";
6115
- var ret;
6116
- if (handlers) {
6117
- for (var i = 0, j = handlers.length; i < j; i++) {
6118
- ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
6119
- }
6120
- }
6121
- if (vm._hasHookEvent) {
6122
- vm.$emit('hook:' + hook, args);
6123
- }
6124
- popTarget();
6125
- return ret
6126
- };
6127
-
6128
- Vue.prototype.__set_model = function(target, key, value, modifiers) {
6129
- if (Array.isArray(modifiers)) {
6130
- if (modifiers.indexOf('trim') !== -1) {
6131
- value = value.trim();
6132
- }
6133
- if (modifiers.indexOf('number') !== -1) {
6134
- value = this._n(value);
6135
- }
6136
- }
6137
- if (!target) {
6138
- target = this;
6139
- }
6140
- // 解决动态属性添加
6141
- Vue.set(target, key, value);
6142
- };
6143
-
6144
- Vue.prototype.__set_sync = function(target, key, value) {
6145
- if (!target) {
6146
- target = this;
6147
- }
6148
- // 解决动态属性添加
6149
- Vue.set(target, key, value);
6150
- };
6151
-
6152
- Vue.prototype.__get_orig = function(item) {
6153
- if (isPlainObject(item)) {
6154
- return item['$orig'] || item
6155
- }
6156
- return item
6157
- };
6158
-
6159
- Vue.prototype.__get_value = function(dataPath, target) {
6160
- return getTarget(target || this, dataPath)
6161
- };
6162
-
6163
-
6164
- Vue.prototype.__get_class = function(dynamicClass, staticClass) {
6165
- return renderClass(staticClass, dynamicClass)
6166
- };
6167
-
6168
- Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
6169
- if (!dynamicStyle && !staticStyle) {
6170
- return ''
6171
- }
6172
- var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
6173
- var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
6174
- return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
6175
- };
6176
-
6177
- Vue.prototype.__map = function(val, iteratee) {
6178
- //TODO 暂不考虑 string
6179
- var ret, i, l, keys, key;
6180
- if (Array.isArray(val)) {
6181
- ret = new Array(val.length);
6182
- for (i = 0, l = val.length; i < l; i++) {
6183
- ret[i] = iteratee(val[i], i);
6184
- }
6185
- return ret
6186
- } else if (isObject(val)) {
6187
- keys = Object.keys(val);
6188
- ret = Object.create(null);
6189
- for (i = 0, l = keys.length; i < l; i++) {
6190
- key = keys[i];
6191
- ret[key] = iteratee(val[key], key, i);
6192
- }
6193
- return ret
6194
- } else if (typeof val === 'number') {
6195
- ret = new Array(val);
6196
- for (i = 0, l = val; i < l; i++) {
6197
- // 第一个参数暂时仍和小程序一致
6198
- ret[i] = iteratee(i, i);
6199
- }
6200
- return ret
6201
- }
6202
- return []
6203
- };
6204
-
6205
- }
6206
-
6207
- /* */
6208
-
6209
- var LIFECYCLE_HOOKS$1 = [
6210
- //App
6211
- 'onLaunch',
6212
- 'onShow',
6213
- 'onHide',
6214
- 'onUniNViewMessage',
6215
- 'onPageNotFound',
6216
- 'onThemeChange',
6217
- 'onError',
6218
- 'onUnhandledRejection',
6219
- //Page
6220
- 'onInit',
6221
- 'onLoad',
6222
- // 'onShow',
6223
- 'onReady',
6224
- // 'onHide',
6225
- 'onUnload',
6226
- 'onPullDownRefresh',
6227
- 'onReachBottom',
6228
- 'onTabItemTap',
6229
- 'onAddToFavorites',
6230
- 'onShareTimeline',
6231
- 'onShareAppMessage',
6232
- 'onResize',
6233
- 'onPageScroll',
6234
- 'onNavigationBarButtonTap',
6235
- 'onBackPress',
6236
- 'onNavigationBarSearchInputChanged',
6237
- 'onNavigationBarSearchInputConfirmed',
6238
- 'onNavigationBarSearchInputClicked',
6239
- 'onUploadDouyinVideo',
6240
- 'onNFCReadMessage',
6241
- //Component
6242
- // 'onReady', // 兼容旧版本,应该移除该事件
6243
- 'onPageShow',
6244
- 'onPageHide',
6245
- 'onPageResize'
6246
- ];
6247
- function lifecycleMixin$1(Vue) {
6248
-
6249
- //fixed vue-class-component
6250
- var oldExtend = Vue.extend;
6251
- Vue.extend = function(extendOptions) {
6252
- extendOptions = extendOptions || {};
6253
-
6254
- var methods = extendOptions.methods;
6255
- if (methods) {
6256
- Object.keys(methods).forEach(function (methodName) {
6257
- if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
6258
- extendOptions[methodName] = methods[methodName];
6259
- delete methods[methodName];
6260
- }
6261
- });
6262
- }
6263
-
6264
- return oldExtend.call(this, extendOptions)
6265
- };
6266
-
6267
- var strategies = Vue.config.optionMergeStrategies;
6268
- var mergeHook = strategies.created;
6269
- LIFECYCLE_HOOKS$1.forEach(function (hook) {
6270
- strategies[hook] = mergeHook;
6271
- });
6272
-
6273
- Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
6274
- }
6275
-
6276
- /* */
6277
-
6278
- // install platform patch function
6279
- Vue.prototype.__patch__ = patch;
6280
-
6281
- // public mount method
6282
- Vue.prototype.$mount = function(
6283
- el ,
6284
- hydrating
6285
- ) {
6286
- return mountComponent$1(this, el, hydrating)
6287
- };
6288
-
6289
- lifecycleMixin$1(Vue);
6040
+ /* */
6041
+
6042
+ var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
6043
+
6044
+ function getTarget(obj, path) {
6045
+ var parts = path.split('.');
6046
+ var key = parts[0];
6047
+ if (key.indexOf('__$n') === 0) { //number index
6048
+ key = parseInt(key.replace('__$n', ''));
6049
+ }
6050
+ if (parts.length === 1) {
6051
+ return obj[key]
6052
+ }
6053
+ return getTarget(obj[key], parts.slice(1).join('.'))
6054
+ }
6055
+
6056
+ function internalMixin(Vue) {
6057
+
6058
+ Vue.config.errorHandler = function(err, vm, info) {
6059
+ Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
6060
+ console.error(err);
6061
+ /* eslint-disable no-undef */
6062
+ var app = typeof getApp === 'function' && getApp();
6063
+ if (app && app.onError) {
6064
+ app.onError(err);
6065
+ }
6066
+ };
6067
+
6068
+ var oldEmit = Vue.prototype.$emit;
6069
+
6070
+ Vue.prototype.$emit = function(event) {
6071
+ if (this.$scope && event) {
6072
+ var triggerEvent = this.$scope['_triggerEvent'] || this.$scope['triggerEvent'];
6073
+ if (triggerEvent) {
6074
+ try {
6075
+ triggerEvent.call(this.$scope, event, {
6076
+ __args__: toArray(arguments, 1)
6077
+ });
6078
+ } catch (error) {
6079
+
6080
+ }
6081
+ }
6082
+ }
6083
+ return oldEmit.apply(this, arguments)
6084
+ };
6085
+
6086
+ Vue.prototype.$nextTick = function(fn) {
6087
+ return nextTick$1(this, fn)
6088
+ };
6089
+
6090
+ MP_METHODS.forEach(function (method) {
6091
+ Vue.prototype[method] = function(args) {
6092
+ if (this.$scope && this.$scope[method]) {
6093
+ return this.$scope[method](args)
6094
+ }
6095
+ // mp-alipay
6096
+ if (typeof my === 'undefined') {
6097
+ return
6098
+ }
6099
+ if (method === 'createSelectorQuery') {
6100
+ /* eslint-disable no-undef */
6101
+ return my.createSelectorQuery(args)
6102
+ } else if (method === 'createIntersectionObserver') {
6103
+ /* eslint-disable no-undef */
6104
+ return my.createIntersectionObserver(args)
6105
+ }
6106
+ // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
6107
+ };
6108
+ });
6109
+
6110
+ Vue.prototype.__init_provide = initProvide;
6111
+
6112
+ Vue.prototype.__init_injections = initInjections;
6113
+
6114
+ Vue.prototype.__call_hook = function(hook, args) {
6115
+ var vm = this;
6116
+ // #7573 disable dep collection when invoking lifecycle hooks
6117
+ pushTarget();
6118
+ var handlers = vm.$options[hook];
6119
+ var info = hook + " hook";
6120
+ var ret;
6121
+ if (handlers) {
6122
+ for (var i = 0, j = handlers.length; i < j; i++) {
6123
+ ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
6124
+ }
6125
+ }
6126
+ if (vm._hasHookEvent) {
6127
+ vm.$emit('hook:' + hook, args);
6128
+ }
6129
+ popTarget();
6130
+ return ret
6131
+ };
6132
+
6133
+ Vue.prototype.__set_model = function(target, key, value, modifiers) {
6134
+ if (Array.isArray(modifiers)) {
6135
+ if (modifiers.indexOf('trim') !== -1) {
6136
+ value = value.trim();
6137
+ }
6138
+ if (modifiers.indexOf('number') !== -1) {
6139
+ value = this._n(value);
6140
+ }
6141
+ }
6142
+ if (!target) {
6143
+ target = this;
6144
+ }
6145
+ // 解决动态属性添加
6146
+ Vue.set(target, key, value);
6147
+ };
6148
+
6149
+ Vue.prototype.__set_sync = function(target, key, value) {
6150
+ if (!target) {
6151
+ target = this;
6152
+ }
6153
+ // 解决动态属性添加
6154
+ Vue.set(target, key, value);
6155
+ };
6156
+
6157
+ Vue.prototype.__get_orig = function(item) {
6158
+ if (isPlainObject(item)) {
6159
+ return item['$orig'] || item
6160
+ }
6161
+ return item
6162
+ };
6163
+
6164
+ Vue.prototype.__get_value = function(dataPath, target) {
6165
+ return getTarget(target || this, dataPath)
6166
+ };
6167
+
6168
+
6169
+ Vue.prototype.__get_class = function(dynamicClass, staticClass) {
6170
+ return renderClass(staticClass, dynamicClass)
6171
+ };
6172
+
6173
+ Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
6174
+ if (!dynamicStyle && !staticStyle) {
6175
+ return ''
6176
+ }
6177
+ var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
6178
+ var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
6179
+ return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
6180
+ };
6181
+
6182
+ Vue.prototype.__map = function(val, iteratee) {
6183
+ //TODO 暂不考虑 string
6184
+ var ret, i, l, keys, key;
6185
+ if (Array.isArray(val)) {
6186
+ ret = new Array(val.length);
6187
+ for (i = 0, l = val.length; i < l; i++) {
6188
+ ret[i] = iteratee(val[i], i);
6189
+ }
6190
+ return ret
6191
+ } else if (isObject(val)) {
6192
+ keys = Object.keys(val);
6193
+ ret = Object.create(null);
6194
+ for (i = 0, l = keys.length; i < l; i++) {
6195
+ key = keys[i];
6196
+ ret[key] = iteratee(val[key], key, i);
6197
+ }
6198
+ return ret
6199
+ } else if (typeof val === 'number') {
6200
+ ret = new Array(val);
6201
+ for (i = 0, l = val; i < l; i++) {
6202
+ // 第一个参数暂时仍和小程序一致
6203
+ ret[i] = iteratee(i, i);
6204
+ }
6205
+ return ret
6206
+ }
6207
+ return []
6208
+ };
6209
+
6210
+ }
6211
+
6212
+ /* */
6213
+
6214
+ var LIFECYCLE_HOOKS$1 = [
6215
+ //App
6216
+ 'onLaunch',
6217
+ 'onShow',
6218
+ 'onHide',
6219
+ 'onUniNViewMessage',
6220
+ 'onPageNotFound',
6221
+ 'onThemeChange',
6222
+ 'onError',
6223
+ 'onUnhandledRejection',
6224
+ //Page
6225
+ 'onInit',
6226
+ 'onLoad',
6227
+ // 'onShow',
6228
+ 'onReady',
6229
+ // 'onHide',
6230
+ 'onUnload',
6231
+ 'onPullDownRefresh',
6232
+ 'onReachBottom',
6233
+ 'onTabItemTap',
6234
+ 'onAddToFavorites',
6235
+ 'onShareTimeline',
6236
+ 'onShareAppMessage',
6237
+ 'onResize',
6238
+ 'onPageScroll',
6239
+ 'onNavigationBarButtonTap',
6240
+ 'onBackPress',
6241
+ 'onNavigationBarSearchInputChanged',
6242
+ 'onNavigationBarSearchInputConfirmed',
6243
+ 'onNavigationBarSearchInputClicked',
6244
+ 'onUploadDouyinVideo',
6245
+ 'onNFCReadMessage',
6246
+ //Component
6247
+ // 'onReady', // 兼容旧版本,应该移除该事件
6248
+ 'onPageShow',
6249
+ 'onPageHide',
6250
+ 'onPageResize'
6251
+ ];
6252
+ function lifecycleMixin$1(Vue) {
6253
+
6254
+ //fixed vue-class-component
6255
+ var oldExtend = Vue.extend;
6256
+ Vue.extend = function(extendOptions) {
6257
+ extendOptions = extendOptions || {};
6258
+
6259
+ var methods = extendOptions.methods;
6260
+ if (methods) {
6261
+ Object.keys(methods).forEach(function (methodName) {
6262
+ if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
6263
+ extendOptions[methodName] = methods[methodName];
6264
+ delete methods[methodName];
6265
+ }
6266
+ });
6267
+ }
6268
+
6269
+ return oldExtend.call(this, extendOptions)
6270
+ };
6271
+
6272
+ var strategies = Vue.config.optionMergeStrategies;
6273
+ var mergeHook = strategies.created;
6274
+ LIFECYCLE_HOOKS$1.forEach(function (hook) {
6275
+ strategies[hook] = mergeHook;
6276
+ });
6277
+
6278
+ Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
6279
+ }
6280
+
6281
+ /* */
6282
+
6283
+ // install platform patch function
6284
+ Vue.prototype.__patch__ = patch;
6285
+
6286
+ // public mount method
6287
+ Vue.prototype.$mount = function(
6288
+ el ,
6289
+ hydrating
6290
+ ) {
6291
+ return mountComponent$1(this, el, hydrating)
6292
+ };
6293
+
6294
+ lifecycleMixin$1(Vue);
6290
6295
  internalMixin(Vue);
6291
6296
 
6292
6297
  /* */
@@ -8,7 +8,7 @@
8
8
  "dist",
9
9
  "lib"
10
10
  ],
11
- "sideEffects": false,
11
+ "sideEffects": true,
12
12
  "repository": {
13
13
  "type": "git",
14
14
  "url": "git+https://github.com/dcloudio/uni-app.git",