@dcloudio/vue-cli-plugin-uni 2.0.2-3071020230425001 → 2.0.2-3080320230526001

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/commands/build.js CHANGED
@@ -6,7 +6,8 @@ const {
6
6
  isInHBuilderX,
7
7
  parseJson,
8
8
  parsePagesJson,
9
- parseManifestJson
9
+ parseManifestJson,
10
+ showRunPrompt
10
11
  } = require('@dcloudio/uni-cli-shared')
11
12
 
12
13
  const uniI18n = require('@dcloudio/uni-cli-i18n')
@@ -207,6 +208,9 @@ async function build (args, api, options) {
207
208
  const dirMsg = runByHBuilderX ? ''
208
209
  : `The ${chalk.cyan(targetDirShort)} directory is ready to be deployed.`
209
210
  done(`Build complete. ${dirMsg}`)
211
+ if (process.env.UNI_PLATFORM !== 'h5') {
212
+ showRunPrompt()
213
+ }
210
214
 
211
215
  if (process.env.UNI_PLATFORM === 'h5' && !isInHBuilderX) {
212
216
  console.log()
@@ -216,6 +220,7 @@ async function build (args, api, options) {
216
220
  const dirMsg = runByHBuilderX ? ''
217
221
  : `The ${chalk.cyan(targetDirShort)} directory is ready. `
218
222
  done(`Build complete. ${dirMsg}Watching for changes...`)
223
+ showRunPrompt()
219
224
  }
220
225
  }
221
226
 
@@ -37,7 +37,11 @@ function getAssetsCopyOptions (assetsDir) {
37
37
 
38
38
  global.uniPlugin.platforms.forEach(platform => {
39
39
  if (global.uniPlugin.name !== platform) {
40
- ignore.push(platform + '/**/*')
40
+ if (CopyWebpackPluginVersion > 5) {
41
+ ignore.push(`${process.env.UNI_INPUT_DIR.replace(/\\/g, '/')}/static/${platform}/**/*`)
42
+ } else {
43
+ ignore.push(platform + '/**/*')
44
+ }
41
45
  }
42
46
  })
43
47
 
package/lib/env.js CHANGED
@@ -128,7 +128,7 @@ if (!process.env.UNI_CLOUD_PROVIDER && process.env.UNI_CLOUD_SPACES) {
128
128
  }
129
129
  }))
130
130
  }
131
- } catch (e) {}
131
+ } catch (e) { }
132
132
  }
133
133
 
134
134
  // 安全网络
@@ -256,7 +256,7 @@ if (process.env.UNI_PLATFORM === 'h5') {
256
256
  try {
257
257
  const modules = require('@dcloudio/uni-h5/lib/modules.json')
258
258
  process.UNI_USER_APIS = parseUserApis(treeShaking.modules || [], modules)
259
- } catch (e) {}
259
+ } catch (e) { }
260
260
  }
261
261
  }
262
262
  if (optimization.prefetch) {
@@ -350,6 +350,12 @@ if ((process.env.UNI_PLATFORM === 'mp-kuaishou' || process.env.UNI_PLATFORM ===
350
350
  .SCOPED_SLOTS_COMPILER !== modes[0]) {
351
351
  process.env.SCOPED_SLOTS_COMPILER = modes[2]
352
352
  }
353
+ const slotMultipleInstance = !!platformOptions.slotMultipleInstance
354
+ // 配置 slotMultipleInstance 时,切换 scopedSlotsCompiler 的值 auto 为 augmented 模式
355
+ if (slotMultipleInstance && process.env.SCOPED_SLOTS_COMPILER === modes[1]) {
356
+ process.env.SCOPED_SLOTS_COMPILER = modes[2]
357
+ }
358
+ process.env.SLOT_MULTIPLE_INSTANCE = (slotMultipleInstance).toString()
353
359
 
354
360
  process.env.MERGE_VIRTUAL_HOST_ATTRIBUTES = (!!platformOptions.mergeVirtualHostAttributes).toString()
355
361
 
@@ -479,7 +485,7 @@ if (process.env.UNI_USING_NATIVE || process.env.UNI_USING_V3_NATIVE) {
479
485
  console.log(warningMsg)
480
486
  }
481
487
  }
482
- } catch (e) {}
488
+ } catch (e) { }
483
489
  }
484
490
  if (process.env.NODE_ENV !== 'production') { // 运行模式性能提示
485
491
  let perfMsg = uniI18n.__('pluginUni.runDebugMode')
@@ -153,8 +153,10 @@ global.__error_reporting__ = report
153
153
 
154
154
  process
155
155
  .on('unhandledRejection', (reason, p) => {
156
+ console.log(reason)
156
157
  global.__error_reporting__ && global.__error_reporting__('unhandledRejection', reason)
157
158
  })
158
159
  .on('uncaughtException', err => {
160
+ console.log(err)
159
161
  global.__error_reporting__ && global.__error_reporting__('uncaughtException', err.stack)
160
162
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/vue-cli-plugin-uni",
3
- "version": "2.0.2-3071020230425001",
3
+ "version": "2.0.2-3080320230526001",
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-3071020230425001",
20
+ "@dcloudio/uni-stat": "^2.0.2-3080320230526001",
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": "6855c56ef44e8917cbece6a9101724f7b0aa308c"
44
+ "gitHead": "3da1dede9671eb9bdf9e0c2e5a9a88d7145cb049"
45
45
  }
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * Vue.js v2.6.11
3
- * (c) 2014-2022 Evan You
3
+ * (c) 2014-2023 Evan You
4
4
  * Released under the MIT License.
5
5
  */
6
6
  /* */
@@ -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 (
@@ -5535,148 +5535,148 @@ function type(obj) {
5535
5535
  return Object.prototype.toString.call(obj)
5536
5536
  }
5537
5537
 
5538
- /* */
5539
-
5540
- function flushCallbacks$1(vm) {
5541
- if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
5542
- if (process.env.VUE_APP_DEBUG) {
5543
- var mpInstance = vm.$scope;
5544
- console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
5545
- ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
5546
- }
5547
- var copies = vm.__next_tick_callbacks.slice(0);
5548
- vm.__next_tick_callbacks.length = 0;
5549
- for (var i = 0; i < copies.length; i++) {
5550
- copies[i]();
5551
- }
5552
- }
5553
- }
5554
-
5555
- function hasRenderWatcher(vm) {
5556
- return queue.find(function (watcher) { return vm._watcher === watcher; })
5557
- }
5558
-
5559
- function nextTick$1(vm, cb) {
5560
- //1.nextTick 之前 已 setData 且 setData 还未回调完成
5561
- //2.nextTick 之前存在 render watcher
5538
+ /* */
5539
+
5540
+ function flushCallbacks$1(vm) {
5541
+ if (vm.__next_tick_callbacks && vm.__next_tick_callbacks.length) {
5542
+ if (process.env.VUE_APP_DEBUG) {
5543
+ var mpInstance = vm.$scope;
5544
+ console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
5545
+ ']:flushCallbacks[' + vm.__next_tick_callbacks.length + ']');
5546
+ }
5547
+ var copies = vm.__next_tick_callbacks.slice(0);
5548
+ vm.__next_tick_callbacks.length = 0;
5549
+ for (var i = 0; i < copies.length; i++) {
5550
+ copies[i]();
5551
+ }
5552
+ }
5553
+ }
5554
+
5555
+ function hasRenderWatcher(vm) {
5556
+ return queue.find(function (watcher) { return vm._watcher === watcher; })
5557
+ }
5558
+
5559
+ function nextTick$1(vm, cb) {
5560
+ //1.nextTick 之前 已 setData 且 setData 还未回调完成
5561
+ //2.nextTick 之前存在 render watcher
5562
5562
  if (!vm.__next_tick_pending && !hasRenderWatcher(vm)) {
5563
5563
  if(process.env.VUE_APP_DEBUG){
5564
5564
  var mpInstance = vm.$scope;
5565
5565
  console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + vm._uid +
5566
5566
  ']:nextVueTick');
5567
- }
5568
- return nextTick(cb, vm)
5567
+ }
5568
+ return nextTick(cb, vm)
5569
5569
  }else{
5570
5570
  if(process.env.VUE_APP_DEBUG){
5571
5571
  var mpInstance$1 = vm.$scope;
5572
5572
  console.log('[' + (+new Date) + '][' + (mpInstance$1.is || mpInstance$1.route) + '][' + vm._uid +
5573
5573
  ']:nextMPTick');
5574
5574
  }
5575
- }
5576
- var _resolve;
5577
- if (!vm.__next_tick_callbacks) {
5578
- vm.__next_tick_callbacks = [];
5579
- }
5580
- vm.__next_tick_callbacks.push(function () {
5581
- if (cb) {
5582
- try {
5583
- cb.call(vm);
5584
- } catch (e) {
5585
- handleError(e, vm, 'nextTick');
5586
- }
5587
- } else if (_resolve) {
5588
- _resolve(vm);
5589
- }
5590
- });
5591
- // $flow-disable-line
5592
- if (!cb && typeof Promise !== 'undefined') {
5593
- return new Promise(function (resolve) {
5594
- _resolve = resolve;
5595
- })
5596
- }
5597
- }
5598
-
5599
- /* */
5600
-
5601
- function clearInstance(key, value) {
5602
- // 简易去除 Vue 和小程序组件实例
5603
- if (value) {
5604
- if (value._isVue || value.__v_isMPComponent) {
5605
- return {}
5606
- }
5607
- }
5608
- return value
5609
- }
5610
-
5611
- function cloneWithData(vm) {
5612
- // 确保当前 vm 所有数据被同步
5613
- var ret = Object.create(null);
5614
- var dataKeys = [].concat(
5615
- Object.keys(vm._data || {}),
5616
- Object.keys(vm._computedWatchers || {}));
5617
-
5618
- dataKeys.reduce(function(ret, key) {
5619
- ret[key] = vm[key];
5620
- return ret
5621
- }, ret);
5622
-
5623
- // vue-composition-api
5624
- var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
5625
- var rawBindings = compositionApiState && compositionApiState.rawBindings;
5626
- if (rawBindings) {
5627
- Object.keys(rawBindings).forEach(function (key) {
5628
- ret[key] = vm[key];
5629
- });
5630
- }
5631
-
5632
- //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
5633
- Object.assign(ret, vm.$mp.data || {});
5634
- if (
5635
- Array.isArray(vm.$options.behaviors) &&
5636
- vm.$options.behaviors.indexOf('uni://form-field') !== -1
5637
- ) { //form-field
5638
- ret['name'] = vm.name;
5639
- ret['value'] = vm.value;
5640
- }
5641
-
5642
- return JSON.parse(JSON.stringify(ret, clearInstance))
5643
- }
5644
-
5575
+ }
5576
+ var _resolve;
5577
+ if (!vm.__next_tick_callbacks) {
5578
+ vm.__next_tick_callbacks = [];
5579
+ }
5580
+ vm.__next_tick_callbacks.push(function () {
5581
+ if (cb) {
5582
+ try {
5583
+ cb.call(vm);
5584
+ } catch (e) {
5585
+ handleError(e, vm, 'nextTick');
5586
+ }
5587
+ } else if (_resolve) {
5588
+ _resolve(vm);
5589
+ }
5590
+ });
5591
+ // $flow-disable-line
5592
+ if (!cb && typeof Promise !== 'undefined') {
5593
+ return new Promise(function (resolve) {
5594
+ _resolve = resolve;
5595
+ })
5596
+ }
5597
+ }
5598
+
5599
+ /* */
5600
+
5601
+ function clearInstance(key, value) {
5602
+ // 简易去除 Vue 和小程序组件实例
5603
+ if (value) {
5604
+ if (value._isVue || value.__v_isMPComponent) {
5605
+ return {}
5606
+ }
5607
+ }
5608
+ return value
5609
+ }
5610
+
5611
+ function cloneWithData(vm) {
5612
+ // 确保当前 vm 所有数据被同步
5613
+ var ret = Object.create(null);
5614
+ var dataKeys = [].concat(
5615
+ Object.keys(vm._data || {}),
5616
+ Object.keys(vm._computedWatchers || {}));
5617
+
5618
+ dataKeys.reduce(function(ret, key) {
5619
+ ret[key] = vm[key];
5620
+ return ret
5621
+ }, ret);
5622
+
5623
+ // vue-composition-api
5624
+ var compositionApiState = vm.__composition_api_state__ || vm.__secret_vfa_state__;
5625
+ var rawBindings = compositionApiState && compositionApiState.rawBindings;
5626
+ if (rawBindings) {
5627
+ Object.keys(rawBindings).forEach(function (key) {
5628
+ ret[key] = vm[key];
5629
+ });
5630
+ }
5631
+
5632
+ //TODO 需要把无用数据处理掉,比如 list=>l0 则 list 需要移除,否则多传输一份数据
5633
+ Object.assign(ret, vm.$mp.data || {});
5634
+ if (
5635
+ Array.isArray(vm.$options.behaviors) &&
5636
+ vm.$options.behaviors.indexOf('uni://form-field') !== -1
5637
+ ) { //form-field
5638
+ ret['name'] = vm.name;
5639
+ ret['value'] = vm.value;
5640
+ }
5641
+
5642
+ return JSON.parse(JSON.stringify(ret, clearInstance))
5643
+ }
5644
+
5645
5645
  var patch = function(oldVnode, vnode) {
5646
5646
  var this$1 = this;
5647
-
5648
- if (vnode === null) { //destroy
5649
- return
5650
- }
5651
- if (this.mpType === 'page' || this.mpType === 'component') {
5652
- var mpInstance = this.$scope;
5653
- var data = Object.create(null);
5654
- try {
5655
- data = cloneWithData(this);
5656
- } catch (err) {
5657
- console.error(err);
5658
- }
5659
- data.__webviewId__ = mpInstance.data.__webviewId__;
5660
- var mpData = Object.create(null);
5661
- Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
5662
- mpData[key] = mpInstance.data[key];
5663
- });
5664
- var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
5665
- if (Object.keys(diffData).length) {
5666
- if (process.env.VUE_APP_DEBUG) {
5667
- console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
5668
- ']差量更新',
5669
- JSON.stringify(diffData));
5670
- }
5671
- this.__next_tick_pending = true;
5672
- mpInstance.setData(diffData, function () {
5673
- this$1.__next_tick_pending = false;
5674
- flushCallbacks$1(this$1);
5675
- });
5676
- } else {
5677
- flushCallbacks$1(this);
5678
- }
5679
- }
5647
+
5648
+ if (vnode === null) { //destroy
5649
+ return
5650
+ }
5651
+ if (this.mpType === 'page' || this.mpType === 'component') {
5652
+ var mpInstance = this.$scope;
5653
+ var data = Object.create(null);
5654
+ try {
5655
+ data = cloneWithData(this);
5656
+ } catch (err) {
5657
+ console.error(err);
5658
+ }
5659
+ data.__webviewId__ = mpInstance.data.__webviewId__;
5660
+ var mpData = Object.create(null);
5661
+ Object.keys(data).forEach(function (key) { //仅同步 data 中有的数据
5662
+ mpData[key] = mpInstance.data[key];
5663
+ });
5664
+ var diffData = this.$shouldDiffData === false ? data : diff(data, mpData);
5665
+ if (Object.keys(diffData).length) {
5666
+ if (process.env.VUE_APP_DEBUG) {
5667
+ console.log('[' + (+new Date) + '][' + (mpInstance.is || mpInstance.route) + '][' + this._uid +
5668
+ ']差量更新',
5669
+ JSON.stringify(diffData));
5670
+ }
5671
+ this.__next_tick_pending = true;
5672
+ mpInstance.setData(diffData, function () {
5673
+ this$1.__next_tick_pending = false;
5674
+ flushCallbacks$1(this$1);
5675
+ });
5676
+ } else {
5677
+ flushCallbacks$1(this);
5678
+ }
5679
+ }
5680
5680
  };
5681
5681
 
5682
5682
  /* */
@@ -5817,260 +5817,261 @@ function normalizeStyleBinding (bindingStyle) {
5817
5817
  return bindingStyle
5818
5818
  }
5819
5819
 
5820
- /* */
5821
-
5822
- var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
5823
-
5824
- function getTarget(obj, path) {
5825
- var parts = path.split('.');
5826
- var key = parts[0];
5827
- if (key.indexOf('__$n') === 0) { //number index
5828
- key = parseInt(key.replace('__$n', ''));
5829
- }
5830
- if (parts.length === 1) {
5831
- return obj[key]
5832
- }
5833
- return getTarget(obj[key], parts.slice(1).join('.'))
5834
- }
5835
-
5836
- function internalMixin(Vue) {
5837
-
5838
- Vue.config.errorHandler = function(err, vm, info) {
5839
- Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
5840
- console.error(err);
5841
- /* eslint-disable no-undef */
5842
- var app = typeof getApp === 'function' && getApp();
5843
- if (app && app.onError) {
5844
- app.onError(err);
5845
- }
5846
- };
5847
-
5848
- var oldEmit = Vue.prototype.$emit;
5849
-
5850
- Vue.prototype.$emit = function(event) {
5851
- if (this.$scope && event) {
5852
- var triggerEvent = this.$scope['_triggerEvent'] || this.$scope['triggerEvent'];
5853
- if (triggerEvent) {
5854
- try {
5855
- triggerEvent.call(this.$scope, event, {
5856
- __args__: toArray(arguments, 1)
5857
- });
5858
- } catch (error) {
5859
-
5860
- }
5861
- }
5862
- }
5863
- return oldEmit.apply(this, arguments)
5864
- };
5865
-
5866
- Vue.prototype.$nextTick = function(fn) {
5867
- return nextTick$1(this, fn)
5868
- };
5869
-
5870
- MP_METHODS.forEach(function (method) {
5871
- Vue.prototype[method] = function(args) {
5872
- if (this.$scope && this.$scope[method]) {
5873
- return this.$scope[method](args)
5874
- }
5875
- // mp-alipay
5876
- if (typeof my === 'undefined') {
5877
- return
5878
- }
5879
- if (method === 'createSelectorQuery') {
5880
- /* eslint-disable no-undef */
5881
- return my.createSelectorQuery(args)
5882
- } else if (method === 'createIntersectionObserver') {
5883
- /* eslint-disable no-undef */
5884
- return my.createIntersectionObserver(args)
5885
- }
5886
- // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
5887
- };
5888
- });
5889
-
5890
- Vue.prototype.__init_provide = initProvide;
5891
-
5892
- Vue.prototype.__init_injections = initInjections;
5893
-
5894
- Vue.prototype.__call_hook = function(hook, args) {
5895
- var vm = this;
5896
- // #7573 disable dep collection when invoking lifecycle hooks
5897
- pushTarget();
5898
- var handlers = vm.$options[hook];
5899
- var info = hook + " hook";
5900
- var ret;
5901
- if (handlers) {
5902
- for (var i = 0, j = handlers.length; i < j; i++) {
5903
- ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
5904
- }
5905
- }
5906
- if (vm._hasHookEvent) {
5907
- vm.$emit('hook:' + hook, args);
5908
- }
5909
- popTarget();
5910
- return ret
5911
- };
5912
-
5913
- Vue.prototype.__set_model = function(target, key, value, modifiers) {
5914
- if (Array.isArray(modifiers)) {
5915
- if (modifiers.indexOf('trim') !== -1) {
5916
- value = value.trim();
5917
- }
5918
- if (modifiers.indexOf('number') !== -1) {
5919
- value = this._n(value);
5920
- }
5921
- }
5922
- if (!target) {
5923
- target = this;
5924
- }
5925
- // 解决动态属性添加
5926
- Vue.set(target, key, value);
5927
- };
5928
-
5929
- Vue.prototype.__set_sync = function(target, key, value) {
5930
- if (!target) {
5931
- target = this;
5932
- }
5933
- // 解决动态属性添加
5934
- Vue.set(target, key, value);
5935
- };
5936
-
5937
- Vue.prototype.__get_orig = function(item) {
5938
- if (isPlainObject(item)) {
5939
- return item['$orig'] || item
5940
- }
5941
- return item
5942
- };
5943
-
5944
- Vue.prototype.__get_value = function(dataPath, target) {
5945
- return getTarget(target || this, dataPath)
5946
- };
5947
-
5948
-
5949
- Vue.prototype.__get_class = function(dynamicClass, staticClass) {
5950
- return renderClass(staticClass, dynamicClass)
5951
- };
5952
-
5953
- Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
5954
- if (!dynamicStyle && !staticStyle) {
5955
- return ''
5956
- }
5957
- var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
5958
- var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
5959
- return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
5960
- };
5961
-
5962
- Vue.prototype.__map = function(val, iteratee) {
5963
- //TODO 暂不考虑 string
5964
- var ret, i, l, keys, key;
5965
- if (Array.isArray(val)) {
5966
- ret = new Array(val.length);
5967
- for (i = 0, l = val.length; i < l; i++) {
5968
- ret[i] = iteratee(val[i], i);
5969
- }
5970
- return ret
5971
- } else if (isObject(val)) {
5972
- keys = Object.keys(val);
5973
- ret = Object.create(null);
5974
- for (i = 0, l = keys.length; i < l; i++) {
5975
- key = keys[i];
5976
- ret[key] = iteratee(val[key], key, i);
5977
- }
5978
- return ret
5979
- } else if (typeof val === 'number') {
5980
- ret = new Array(val);
5981
- for (i = 0, l = val; i < l; i++) {
5982
- // 第一个参数暂时仍和小程序一致
5983
- ret[i] = iteratee(i, i);
5984
- }
5985
- return ret
5986
- }
5987
- return []
5988
- };
5989
-
5990
- }
5991
-
5992
- /* */
5993
-
5994
- var LIFECYCLE_HOOKS$1 = [
5995
- //App
5996
- 'onLaunch',
5997
- 'onShow',
5998
- 'onHide',
5999
- 'onUniNViewMessage',
6000
- 'onPageNotFound',
6001
- 'onThemeChange',
6002
- 'onError',
6003
- 'onUnhandledRejection',
6004
- //Page
6005
- 'onInit',
6006
- 'onLoad',
6007
- // 'onShow',
6008
- 'onReady',
6009
- // 'onHide',
6010
- 'onUnload',
6011
- 'onPullDownRefresh',
6012
- 'onReachBottom',
6013
- 'onTabItemTap',
6014
- 'onAddToFavorites',
6015
- 'onShareTimeline',
6016
- 'onShareAppMessage',
6017
- 'onResize',
6018
- 'onPageScroll',
6019
- 'onNavigationBarButtonTap',
6020
- 'onBackPress',
6021
- 'onNavigationBarSearchInputChanged',
6022
- 'onNavigationBarSearchInputConfirmed',
6023
- 'onNavigationBarSearchInputClicked',
6024
- //Component
6025
- // 'onReady', // 兼容旧版本,应该移除该事件
6026
- 'onPageShow',
6027
- 'onPageHide',
6028
- 'onPageResize',
6029
- 'onUploadDouyinVideo'
6030
- ];
6031
- function lifecycleMixin$1(Vue) {
6032
-
6033
- //fixed vue-class-component
6034
- var oldExtend = Vue.extend;
6035
- Vue.extend = function(extendOptions) {
6036
- extendOptions = extendOptions || {};
6037
-
6038
- var methods = extendOptions.methods;
6039
- if (methods) {
6040
- Object.keys(methods).forEach(function (methodName) {
6041
- if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
6042
- extendOptions[methodName] = methods[methodName];
6043
- delete methods[methodName];
6044
- }
6045
- });
6046
- }
6047
-
6048
- return oldExtend.call(this, extendOptions)
6049
- };
6050
-
6051
- var strategies = Vue.config.optionMergeStrategies;
6052
- var mergeHook = strategies.created;
6053
- LIFECYCLE_HOOKS$1.forEach(function (hook) {
6054
- strategies[hook] = mergeHook;
6055
- });
6056
-
6057
- Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
6058
- }
6059
-
6060
- /* */
6061
-
6062
- // install platform patch function
6063
- Vue.prototype.__patch__ = patch;
6064
-
6065
- // public mount method
6066
- Vue.prototype.$mount = function(
6067
- el ,
6068
- hydrating
6069
- ) {
6070
- return mountComponent$1(this, el, hydrating)
6071
- };
6072
-
6073
- lifecycleMixin$1(Vue);
5820
+ /* */
5821
+
5822
+ var MP_METHODS = ['createSelectorQuery', 'createIntersectionObserver', 'selectAllComponents', 'selectComponent'];
5823
+
5824
+ function getTarget(obj, path) {
5825
+ var parts = path.split('.');
5826
+ var key = parts[0];
5827
+ if (key.indexOf('__$n') === 0) { //number index
5828
+ key = parseInt(key.replace('__$n', ''));
5829
+ }
5830
+ if (parts.length === 1) {
5831
+ return obj[key]
5832
+ }
5833
+ return getTarget(obj[key], parts.slice(1).join('.'))
5834
+ }
5835
+
5836
+ function internalMixin(Vue) {
5837
+
5838
+ Vue.config.errorHandler = function(err, vm, info) {
5839
+ Vue.util.warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
5840
+ console.error(err);
5841
+ /* eslint-disable no-undef */
5842
+ var app = typeof getApp === 'function' && getApp();
5843
+ if (app && app.onError) {
5844
+ app.onError(err);
5845
+ }
5846
+ };
5847
+
5848
+ var oldEmit = Vue.prototype.$emit;
5849
+
5850
+ Vue.prototype.$emit = function(event) {
5851
+ if (this.$scope && event) {
5852
+ var triggerEvent = this.$scope['_triggerEvent'] || this.$scope['triggerEvent'];
5853
+ if (triggerEvent) {
5854
+ try {
5855
+ triggerEvent.call(this.$scope, event, {
5856
+ __args__: toArray(arguments, 1)
5857
+ });
5858
+ } catch (error) {
5859
+
5860
+ }
5861
+ }
5862
+ }
5863
+ return oldEmit.apply(this, arguments)
5864
+ };
5865
+
5866
+ Vue.prototype.$nextTick = function(fn) {
5867
+ return nextTick$1(this, fn)
5868
+ };
5869
+
5870
+ MP_METHODS.forEach(function (method) {
5871
+ Vue.prototype[method] = function(args) {
5872
+ if (this.$scope && this.$scope[method]) {
5873
+ return this.$scope[method](args)
5874
+ }
5875
+ // mp-alipay
5876
+ if (typeof my === 'undefined') {
5877
+ return
5878
+ }
5879
+ if (method === 'createSelectorQuery') {
5880
+ /* eslint-disable no-undef */
5881
+ return my.createSelectorQuery(args)
5882
+ } else if (method === 'createIntersectionObserver') {
5883
+ /* eslint-disable no-undef */
5884
+ return my.createIntersectionObserver(args)
5885
+ }
5886
+ // TODO mp-alipay 暂不支持 selectAllComponents,selectComponent
5887
+ };
5888
+ });
5889
+
5890
+ Vue.prototype.__init_provide = initProvide;
5891
+
5892
+ Vue.prototype.__init_injections = initInjections;
5893
+
5894
+ Vue.prototype.__call_hook = function(hook, args) {
5895
+ var vm = this;
5896
+ // #7573 disable dep collection when invoking lifecycle hooks
5897
+ pushTarget();
5898
+ var handlers = vm.$options[hook];
5899
+ var info = hook + " hook";
5900
+ var ret;
5901
+ if (handlers) {
5902
+ for (var i = 0, j = handlers.length; i < j; i++) {
5903
+ ret = invokeWithErrorHandling(handlers[i], vm, args ? [args] : null, vm, info);
5904
+ }
5905
+ }
5906
+ if (vm._hasHookEvent) {
5907
+ vm.$emit('hook:' + hook, args);
5908
+ }
5909
+ popTarget();
5910
+ return ret
5911
+ };
5912
+
5913
+ Vue.prototype.__set_model = function(target, key, value, modifiers) {
5914
+ if (Array.isArray(modifiers)) {
5915
+ if (modifiers.indexOf('trim') !== -1) {
5916
+ value = value.trim();
5917
+ }
5918
+ if (modifiers.indexOf('number') !== -1) {
5919
+ value = this._n(value);
5920
+ }
5921
+ }
5922
+ if (!target) {
5923
+ target = this;
5924
+ }
5925
+ // 解决动态属性添加
5926
+ Vue.set(target, key, value);
5927
+ };
5928
+
5929
+ Vue.prototype.__set_sync = function(target, key, value) {
5930
+ if (!target) {
5931
+ target = this;
5932
+ }
5933
+ // 解决动态属性添加
5934
+ Vue.set(target, key, value);
5935
+ };
5936
+
5937
+ Vue.prototype.__get_orig = function(item) {
5938
+ if (isPlainObject(item)) {
5939
+ return item['$orig'] || item
5940
+ }
5941
+ return item
5942
+ };
5943
+
5944
+ Vue.prototype.__get_value = function(dataPath, target) {
5945
+ return getTarget(target || this, dataPath)
5946
+ };
5947
+
5948
+
5949
+ Vue.prototype.__get_class = function(dynamicClass, staticClass) {
5950
+ return renderClass(staticClass, dynamicClass)
5951
+ };
5952
+
5953
+ Vue.prototype.__get_style = function(dynamicStyle, staticStyle) {
5954
+ if (!dynamicStyle && !staticStyle) {
5955
+ return ''
5956
+ }
5957
+ var dynamicStyleObj = normalizeStyleBinding(dynamicStyle);
5958
+ var styleObj = staticStyle ? extend(staticStyle, dynamicStyleObj) : dynamicStyleObj;
5959
+ return Object.keys(styleObj).map(function (name) { return ((hyphenate(name)) + ":" + (styleObj[name])); }).join(';')
5960
+ };
5961
+
5962
+ Vue.prototype.__map = function(val, iteratee) {
5963
+ //TODO 暂不考虑 string
5964
+ var ret, i, l, keys, key;
5965
+ if (Array.isArray(val)) {
5966
+ ret = new Array(val.length);
5967
+ for (i = 0, l = val.length; i < l; i++) {
5968
+ ret[i] = iteratee(val[i], i);
5969
+ }
5970
+ return ret
5971
+ } else if (isObject(val)) {
5972
+ keys = Object.keys(val);
5973
+ ret = Object.create(null);
5974
+ for (i = 0, l = keys.length; i < l; i++) {
5975
+ key = keys[i];
5976
+ ret[key] = iteratee(val[key], key, i);
5977
+ }
5978
+ return ret
5979
+ } else if (typeof val === 'number') {
5980
+ ret = new Array(val);
5981
+ for (i = 0, l = val; i < l; i++) {
5982
+ // 第一个参数暂时仍和小程序一致
5983
+ ret[i] = iteratee(i, i);
5984
+ }
5985
+ return ret
5986
+ }
5987
+ return []
5988
+ };
5989
+
5990
+ }
5991
+
5992
+ /* */
5993
+
5994
+ var LIFECYCLE_HOOKS$1 = [
5995
+ //App
5996
+ 'onLaunch',
5997
+ 'onShow',
5998
+ 'onHide',
5999
+ 'onUniNViewMessage',
6000
+ 'onPageNotFound',
6001
+ 'onThemeChange',
6002
+ 'onError',
6003
+ 'onUnhandledRejection',
6004
+ //Page
6005
+ 'onInit',
6006
+ 'onLoad',
6007
+ // 'onShow',
6008
+ 'onReady',
6009
+ // 'onHide',
6010
+ 'onUnload',
6011
+ 'onPullDownRefresh',
6012
+ 'onReachBottom',
6013
+ 'onTabItemTap',
6014
+ 'onAddToFavorites',
6015
+ 'onShareTimeline',
6016
+ 'onShareAppMessage',
6017
+ 'onResize',
6018
+ 'onPageScroll',
6019
+ 'onNavigationBarButtonTap',
6020
+ 'onBackPress',
6021
+ 'onNavigationBarSearchInputChanged',
6022
+ 'onNavigationBarSearchInputConfirmed',
6023
+ 'onNavigationBarSearchInputClicked',
6024
+ 'onUploadDouyinVideo',
6025
+ 'onNFCReadMessage',
6026
+ //Component
6027
+ // 'onReady', // 兼容旧版本,应该移除该事件
6028
+ 'onPageShow',
6029
+ 'onPageHide',
6030
+ 'onPageResize'
6031
+ ];
6032
+ function lifecycleMixin$1(Vue) {
6033
+
6034
+ //fixed vue-class-component
6035
+ var oldExtend = Vue.extend;
6036
+ Vue.extend = function(extendOptions) {
6037
+ extendOptions = extendOptions || {};
6038
+
6039
+ var methods = extendOptions.methods;
6040
+ if (methods) {
6041
+ Object.keys(methods).forEach(function (methodName) {
6042
+ if (LIFECYCLE_HOOKS$1.indexOf(methodName)!==-1) {
6043
+ extendOptions[methodName] = methods[methodName];
6044
+ delete methods[methodName];
6045
+ }
6046
+ });
6047
+ }
6048
+
6049
+ return oldExtend.call(this, extendOptions)
6050
+ };
6051
+
6052
+ var strategies = Vue.config.optionMergeStrategies;
6053
+ var mergeHook = strategies.created;
6054
+ LIFECYCLE_HOOKS$1.forEach(function (hook) {
6055
+ strategies[hook] = mergeHook;
6056
+ });
6057
+
6058
+ Vue.prototype.__lifecycle_hooks__ = LIFECYCLE_HOOKS$1;
6059
+ }
6060
+
6061
+ /* */
6062
+
6063
+ // install platform patch function
6064
+ Vue.prototype.__patch__ = patch;
6065
+
6066
+ // public mount method
6067
+ Vue.prototype.$mount = function(
6068
+ el ,
6069
+ hydrating
6070
+ ) {
6071
+ return mountComponent$1(this, el, hydrating)
6072
+ };
6073
+
6074
+ lifecycleMixin$1(Vue);
6074
6075
  internalMixin(Vue);
6075
6076
 
6076
6077
  /* */