@dcloudio/uni-mp-toutiao 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.
- package/dist/uni.mp.esm.js +38 -5
- package/package.json +8 -8
package/dist/uni.mp.esm.js
CHANGED
|
@@ -400,7 +400,7 @@ const builtInProps = [
|
|
|
400
400
|
// 小程序不能直接定义 $slots 的 props,所以通过 vueSlots 转换到 $slots
|
|
401
401
|
'uS',
|
|
402
402
|
];
|
|
403
|
-
function initDefaultProps(isBehavior = false) {
|
|
403
|
+
function initDefaultProps(options, isBehavior = false) {
|
|
404
404
|
const properties = {};
|
|
405
405
|
if (!isBehavior) {
|
|
406
406
|
// 均不指定类型,避免微信小程序 property received type-uncompatible value 警告
|
|
@@ -426,6 +426,19 @@ function initDefaultProps(isBehavior = false) {
|
|
|
426
426
|
},
|
|
427
427
|
};
|
|
428
428
|
}
|
|
429
|
+
if (options.behaviors) {
|
|
430
|
+
// wx://form-field
|
|
431
|
+
if (options.behaviors.includes('tt://form-field')) {
|
|
432
|
+
properties.name = {
|
|
433
|
+
type: null,
|
|
434
|
+
value: '',
|
|
435
|
+
};
|
|
436
|
+
properties.value = {
|
|
437
|
+
type: null,
|
|
438
|
+
value: '',
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
}
|
|
429
442
|
return properties;
|
|
430
443
|
}
|
|
431
444
|
function initVirtualHostProps(options) {
|
|
@@ -441,7 +454,7 @@ function initProps(mpComponentOptions) {
|
|
|
441
454
|
if (!mpComponentOptions.properties) {
|
|
442
455
|
mpComponentOptions.properties = {};
|
|
443
456
|
}
|
|
444
|
-
extend(mpComponentOptions.properties, initDefaultProps(), initVirtualHostProps(mpComponentOptions.options));
|
|
457
|
+
extend(mpComponentOptions.properties, initDefaultProps(mpComponentOptions), initVirtualHostProps(mpComponentOptions.options));
|
|
445
458
|
}
|
|
446
459
|
const PROP_TYPES = [String, Number, Boolean, Object, Array, null];
|
|
447
460
|
function parsePropType(type, defaultValue) {
|
|
@@ -509,6 +522,22 @@ function findPagePropsData(properties) {
|
|
|
509
522
|
});
|
|
510
523
|
}
|
|
511
524
|
return propsData;
|
|
525
|
+
}
|
|
526
|
+
function initFormField(vm) {
|
|
527
|
+
// 同步 form-field 的 name,value 值
|
|
528
|
+
const vueOptions = vm.$options;
|
|
529
|
+
if (isArray(vueOptions.behaviors) &&
|
|
530
|
+
vueOptions.behaviors.includes('uni://form-field')) {
|
|
531
|
+
vm.$watch('modelValue', () => {
|
|
532
|
+
vm.$scope &&
|
|
533
|
+
vm.$scope.setData({
|
|
534
|
+
name: vm.name,
|
|
535
|
+
value: vm.modelValue,
|
|
536
|
+
});
|
|
537
|
+
}, {
|
|
538
|
+
immediate: true,
|
|
539
|
+
});
|
|
540
|
+
}
|
|
512
541
|
}
|
|
513
542
|
|
|
514
543
|
function initData(_) {
|
|
@@ -582,14 +611,14 @@ function initBehaviors(vueOptions) {
|
|
|
582
611
|
if (behavior === 'uni://form-field') {
|
|
583
612
|
if (isArray(vueProps)) {
|
|
584
613
|
vueProps.push('name');
|
|
585
|
-
vueProps.push('
|
|
614
|
+
vueProps.push('modelValue');
|
|
586
615
|
}
|
|
587
616
|
else {
|
|
588
617
|
vueProps.name = {
|
|
589
618
|
type: String,
|
|
590
619
|
default: '',
|
|
591
620
|
};
|
|
592
|
-
vueProps.
|
|
621
|
+
vueProps.modelValue = {
|
|
593
622
|
type: [String, Number, Boolean, Array, Object, Date],
|
|
594
623
|
default: '',
|
|
595
624
|
};
|
|
@@ -853,9 +882,10 @@ function initLifetimes$1({ mocks, isPage, initRelation, vueOptions, }) {
|
|
|
853
882
|
if (mpType === 'page' && !mpInstance.route && mpInstance.__route__) {
|
|
854
883
|
mpInstance.route = mpInstance.__route__;
|
|
855
884
|
}
|
|
885
|
+
const props = findPropsData(properties, mpType === 'page');
|
|
856
886
|
this.$vm = $createComponent({
|
|
857
887
|
type: vueOptions,
|
|
858
|
-
props
|
|
888
|
+
props,
|
|
859
889
|
}, {
|
|
860
890
|
mpType,
|
|
861
891
|
mpInstance,
|
|
@@ -867,6 +897,9 @@ function initLifetimes$1({ mocks, isPage, initRelation, vueOptions, }) {
|
|
|
867
897
|
initComponentInstance(instance, options);
|
|
868
898
|
},
|
|
869
899
|
});
|
|
900
|
+
if (mpType === 'component') {
|
|
901
|
+
initFormField(this.$vm);
|
|
902
|
+
}
|
|
870
903
|
// 处理父子关系
|
|
871
904
|
initRelation(this, relationOptions);
|
|
872
905
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-mp-toutiao",
|
|
3
|
-
"version": "3.0.0-alpha-
|
|
3
|
+
"version": "3.0.0-alpha-3060720221017002",
|
|
4
4
|
"description": "uni-app mp-toutiao",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
},
|
|
27
27
|
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@dcloudio/uni-cli-shared": "3.0.0-alpha-
|
|
30
|
-
"@dcloudio/uni-mp-compiler": "3.0.0-alpha-
|
|
31
|
-
"@dcloudio/uni-mp-vite": "3.0.0-alpha-
|
|
32
|
-
"@dcloudio/uni-mp-vue": "3.0.0-alpha-
|
|
33
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
34
|
-
"@vue/shared": "3.2.
|
|
35
|
-
"@vue/compiler-core": "3.2.
|
|
29
|
+
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3060720221017002",
|
|
30
|
+
"@dcloudio/uni-mp-compiler": "3.0.0-alpha-3060720221017002",
|
|
31
|
+
"@dcloudio/uni-mp-vite": "3.0.0-alpha-3060720221017002",
|
|
32
|
+
"@dcloudio/uni-mp-vue": "3.0.0-alpha-3060720221017002",
|
|
33
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-3060720221017002",
|
|
34
|
+
"@vue/shared": "3.2.41",
|
|
35
|
+
"@vue/compiler-core": "3.2.41"
|
|
36
36
|
}
|
|
37
37
|
}
|