mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-27 11:56:39 +08:00
* feat(calendar): synchronize the vant calendar component, and add the attribute of custom week starting from the day of the week * feat(calendar): supplement to the description document of calendar components * feat(calendar): remove the validator of firstDayOfWeek attribute
40 lines
764 B
TypeScript
40 lines
764 B
TypeScript
import { VantComponent } from '../../../common/component';
|
|
|
|
VantComponent({
|
|
props: {
|
|
title: {
|
|
type: String,
|
|
value: '日期选择',
|
|
},
|
|
subtitle: String,
|
|
showTitle: Boolean,
|
|
showSubtitle: Boolean,
|
|
firstDayOfWeek: {
|
|
type: Number,
|
|
observer: 'initWeekDay',
|
|
},
|
|
},
|
|
|
|
data: {
|
|
weekdays: [] as Array<string>,
|
|
},
|
|
|
|
created() {
|
|
this.initWeekDay();
|
|
},
|
|
|
|
methods: {
|
|
initWeekDay() {
|
|
const defaultWeeks = ['日', '一', '二', '三', '四', '五', '六'];
|
|
const firstDayOfWeek = this.data.firstDayOfWeek || 0;
|
|
|
|
this.setData({
|
|
weekdays: [
|
|
...defaultWeeks.slice(firstDayOfWeek, 7),
|
|
...defaultWeeks.slice(0, firstDayOfWeek),
|
|
],
|
|
});
|
|
},
|
|
},
|
|
});
|