Skip to content

Commit 8e55230

Browse files
committed
fix(Calendar): 修复由于 optionalTypes 导致日期无法选中
close #1460
1 parent 38279b3 commit 8e55230

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/calendar/components/mounth/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ Component({
66
},
77
properties: {
88
minDate: {
9-
optionalTypes: [Object,String],
9+
type: Object,
10+
optionalTypes: [String, null],
1011
},
1112
maxDate: {
12-
optionalTypes: [Object,String],
13+
type: Object,
14+
optionalTypes: [String, null],
1315
},
1416
formatter: {
1517
type: null,
@@ -20,7 +22,8 @@ Component({
2022
observer: 'setDays'
2123
},
2224
currentDate: {
23-
optionalTypes: [Array],
25+
type: Array,
26+
optionalTypes: [null],
2427
observer() {
2528
this.setDays();
2629
}

src/calendar/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Component({
3636
},
3737
defaultDate: {
3838
optionalTypes: [String, Number, Date, Array],
39+
value: '',
3940
observer() {
4041
this.setData({ currentDate: this.initCurrentDate() });
4142
}
@@ -45,15 +46,18 @@ Component({
4546
value: 'timestamp'
4647
},
4748
formatter: {
48-
type: Object,
49+
type: Function,
50+
optionalTypes: [null],
4951
value: null
5052
},
5153
minDate: {
52-
optionalTypes: [String, Number],
54+
type: String,
55+
optionalTypes: [null, Number],
5356
value: Date.now()
5457
},
5558
maxDate: {
56-
optionalTypes: [String, Number],
59+
type: String,
60+
optionalTypes: [null, Number],
5761
value: new Date(
5862
new Date().getFullYear(),
5963
new Date().getMonth() + 6,
@@ -62,10 +66,12 @@ Component({
6266
},
6367
minSelect: {
6468
type: Number,
69+
optionalTypes: [null],
6570
value: null
6671
},
6772
maxSelect: {
6873
type: Number,
74+
optionalTypes: [null],
6975
value: null
7076
},
7177
allowSameDay: Boolean,

0 commit comments

Comments
 (0)