Skip to content

Commit

Permalink
feat(demo): debug startDate and endDate props
Browse files Browse the repository at this point in the history
  • Loading branch information
KuangPF committed Nov 1, 2020
1 parent 142288a commit 577e44c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/mpvue-picker/mpvuePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export default {
// 日期选择器的时候的大小默认值
minDateIndex: [],
maxDateIndex: [],
maxDateIndex: []
};
},
props: {
Expand Down Expand Up @@ -262,11 +262,11 @@ export default {
for (let i = MIN_DATE.getFullYear(); i <= MAX_DATE.getFullYear(); i++) {
yearList.push({ label: i + '', value: i });
if (i == this.startDate.getFullYear()) {
if (i === this.startDate.getFullYear()) {
this.minDateIndex.push(yearList.length - 1);
}
if (i == this.endDate.getFullYear()) {
if (i === this.endDate.getFullYear()) {
this.maxDateIndex.push(yearList.length - 1);
}
}
Expand Down Expand Up @@ -415,9 +415,9 @@ export default {
label: this._getPickerLabelAndValue(this.pickerValue, this.mode).label
};
if (this.mode == 'dateSelector') {
if (this.mode === 'dateSelector') {
let date = new Date(pickObj.value[0], (pickObj.value[1] - 1), pickObj.value[2])
if (date.getTime() < this.startDate.getTime()) {
this.pickerValue = this.minDateIndex
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/demo/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<button type="default" @click="showMulLinkageTwoPicker">二级联动选择</button>
<button type="default" @click="showMulLinkageThreePicker">三级联动选择</button>
</div>
<mpvue-picker ref="mpvuePicker" :mode="mode" :deepLength="deepLength" :pickerValueDefault="pickerValueDefault" :themeColor="themeColor" @onChange="onChange" @onConfirm="onConfirm" @onCancel="onCancel" :pickerValueArray="pickerValueArray"></mpvue-picker>
<mpvue-picker ref="mpvuePicker" :startDate="new Date('2000-01-01')" :endDate="new Date('2001-01-01')" :mode="mode" :deepLength="deepLength" :pickerValueDefault="pickerValueDefault" :themeColor="themeColor" @onChange="onChange" @onConfirm="onConfirm" @onCancel="onCancel" :pickerValueArray="pickerValueArray"></mpvue-picker>
</div>
</template>

Expand Down

0 comments on commit 577e44c

Please sign in to comment.