@dcloudio/uni-quickapp-webview 3.0.0-alpha-3060720221014001 → 3.0.0-alpha-3060720221017002

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/uni.mp.esm.js +38 -5
  2. package/package.json +7 -7
@@ -378,7 +378,7 @@ const builtInProps = [
378
378
  // 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
379
379
  'uS',
380
380
  ];
381
- function initDefaultProps(isBehavior = false) {
381
+ function initDefaultProps(options, isBehavior = false) {
382
382
  const properties = {};
383
383
  if (!isBehavior) {
384
384
  // 均不指定类型,避免微信小程序 property received type-uncompatible value 警告
@@ -404,6 +404,19 @@ function initDefaultProps(isBehavior = false) {
404
404
  },
405
405
  };
406
406
  }
407
+ if (options.behaviors) {
408
+ // wx://form-field
409
+ if (options.behaviors.includes('qa://form-field')) {
410
+ properties.name = {
411
+ type: null,
412
+ value: '',
413
+ };
414
+ properties.value = {
415
+ type: null,
416
+ value: '',
417
+ };
418
+ }
419
+ }
407
420
  return properties;
408
421
  }
409
422
  function initVirtualHostProps(options) {
@@ -419,7 +432,7 @@ function initProps(mpComponentOptions) {
419
432
  if (!mpComponentOptions.properties) {
420
433
  mpComponentOptions.properties = {};
421
434
  }
422
- extend(mpComponentOptions.properties, initDefaultProps(), initVirtualHostProps(mpComponentOptions.options));
435
+ extend(mpComponentOptions.properties, initDefaultProps(mpComponentOptions), initVirtualHostProps(mpComponentOptions.options));
423
436
  }
424
437
  const PROP_TYPES = [String, Number, Boolean, Object, Array, null];
425
438
  function parsePropType(type, defaultValue) {
@@ -487,6 +500,22 @@ function findPagePropsData(properties) {
487
500
  });
488
501
  }
489
502
  return propsData;
503
+ }
504
+ function initFormField(vm) {
505
+ // 同步 form-field 的 name,value 值
506
+ const vueOptions = vm.$options;
507
+ if (isArray(vueOptions.behaviors) &&
508
+ vueOptions.behaviors.includes('uni://form-field')) {
509
+ vm.$watch('modelValue', () => {
510
+ vm.$scope &&
511
+ vm.$scope.setData({
512
+ name: vm.name,
513
+ value: vm.modelValue,
514
+ });
515
+ }, {
516
+ immediate: true,
517
+ });
518
+ }
490
519
  }
491
520
 
492
521
  function initData(_) {
@@ -556,14 +585,14 @@ function initBehaviors(vueOptions) {
556
585
  if (behavior === 'uni://form-field') {
557
586
  if (isArray(vueProps)) {
558
587
  vueProps.push('name');
559
- vueProps.push('value');
588
+ vueProps.push('modelValue');
560
589
  }
561
590
  else {
562
591
  vueProps.name = {
563
592
  type: String,
564
593
  default: '',
565
594
  };
566
- vueProps.value = {
595
+ vueProps.modelValue = {
567
596
  type: [String, Number, Boolean, Array, Object, Date],
568
597
  default: '',
569
598
  };
@@ -818,9 +847,10 @@ function initLifetimes$1({ mocks, isPage, initRelation, vueOptions, }) {
818
847
  if (mpType === 'page' && !mpInstance.route && mpInstance.__route__) {
819
848
  mpInstance.route = mpInstance.__route__;
820
849
  }
850
+ const props = findPropsData(properties, mpType === 'page');
821
851
  this.$vm = $createComponent({
822
852
  type: vueOptions,
823
- props: findPropsData(properties, mpType === 'page'),
853
+ props,
824
854
  }, {
825
855
  mpType,
826
856
  mpInstance,
@@ -832,6 +862,9 @@ function initLifetimes$1({ mocks, isPage, initRelation, vueOptions, }) {
832
862
  initComponentInstance(instance, options);
833
863
  },
834
864
  });
865
+ if (mpType === 'component') {
866
+ initFormField(this.$vm);
867
+ }
835
868
  // 处理父子关系
836
869
  initRelation(this, relationOptions);
837
870
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-quickapp-webview",
3
- "version": "3.0.0-alpha-3060720221014001",
3
+ "version": "3.0.0-alpha-3060720221017002",
4
4
  "description": "uni-app quickapp-webview",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -26,13 +26,13 @@
26
26
  },
27
27
  "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
28
28
  "devDependencies": {
29
- "@vue/compiler-core": "3.2.40"
29
+ "@vue/compiler-core": "3.2.41"
30
30
  },
31
31
  "dependencies": {
32
- "@dcloudio/uni-cli-shared": "3.0.0-alpha-3060720221014001",
33
- "@dcloudio/uni-mp-vite": "3.0.0-alpha-3060720221014001",
34
- "@dcloudio/uni-mp-vue": "3.0.0-alpha-3060720221014001",
35
- "@dcloudio/uni-shared": "3.0.0-alpha-3060720221014001",
36
- "@vue/shared": "3.2.40"
32
+ "@dcloudio/uni-cli-shared": "3.0.0-alpha-3060720221017002",
33
+ "@dcloudio/uni-mp-vite": "3.0.0-alpha-3060720221017002",
34
+ "@dcloudio/uni-mp-vue": "3.0.0-alpha-3060720221017002",
35
+ "@dcloudio/uni-shared": "3.0.0-alpha-3060720221017002",
36
+ "@vue/shared": "3.2.41"
37
37
  }
38
38
  }