feat: calendar support firstDayOfWeek (#6468)

This commit is contained in:
yeliex
2020-07-14 11:51:27 +08:00
committed by GitHub
parent 63aa6baa86
commit 5febb845d0
8 changed files with 89 additions and 2 deletions

View File

@@ -81,6 +81,12 @@
:value="formatRange(date.maxRange)"
@click="show('range', 'maxRange')"
/>
<van-cell
is-link
:title="t('firstDayOfWeek')"
@click="show('single', 'firstDayOfWeek')"
/>
</demo-block>
<demo-block card :title="t('tiledDisplay')">
@@ -108,6 +114,7 @@
:show-confirm="showConfirm"
:confirm-text="confirmText"
:confirm-disabled-text="confirmDisabledText"
:first-day-of-week="firstDayOfWeek"
@confirm="onConfirm"
/>
</demo-section>
@@ -139,6 +146,7 @@ export default {
customPosition: '自定义弹出位置',
customCalendar: '自定义日历',
confirmDisabledText: '请选择结束时间',
firstDayOfWeek: '自定义周起始日',
tiledDisplay: '平铺展示',
},
'en-US': {
@@ -161,6 +169,7 @@ export default {
customDayText: 'Custom Day Text',
customPosition: 'Custom Position',
customCalendar: 'Custom Calendar',
firstDayOfWeek: 'Custom First Day Of Week',
confirmDisabledText: 'Select End Time',
tiledDisplay: 'Tiled display',
},
@@ -195,6 +204,7 @@ export default {
tiledMaxDate: new Date(2012, 2, 20),
confirmText: undefined,
confirmDisabledText: undefined,
firstDayOfWeek: 0,
};
},
@@ -210,6 +220,7 @@ export default {
this.showConfirm = true;
this.confirmText = undefined;
this.confirmDisabledText = undefined;
this.firstDayOfWeek = 0;
},
show(type, id) {
@@ -246,6 +257,9 @@ export default {
case 'maxRange':
this.maxRange = 3;
break;
case 'firstDayOfWeek':
this.firstDayOfWeek = 1;
break;
}
},