Calendar
Display date.
Basic
Set value to specify the currently displayed month. If value is not specified, current month is displayed. value supports two-way binding.
Custom Content
Customize what is displayed in the calendar cell by setting scoped-slot named date-cell. In scoped-slot you can get the date (the date of the current cell), data (including the type, isSelected, day attribute). For details, please refer to the API documentation below.
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
09-28 | 09-29 | 09-30 | 10-01 | 10-02 | 10-03 | 10-04 |
10-05 | 10-06 | 10-07 | 10-08 | 10-09 | 10-10 | 10-11 |
10-12 | 10-13 | 10-14 | 10-15 | 10-16 | 10-17 | 10-18 |
10-19 | 10-20 | 10-21 | 10-22 | 10-23 | 10-24 | 10-25 |
10-26 | 10-27 | 10-28 | 10-29 | 10-30 | 10-31 | 11-01 |
Range
Set the range attribute to specify the display range of the calendar. Start time must be Monday, end time must be Sunday, and the time span cannot exceed two months.
Customize header
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
28 | 29 | 30 | 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 | 1 |
Localization
The default locale of is English, if you need to use other languages, please check Internationalization
Note, date time locale (month name, first day of the week ...) are also configured in localization.
API
Attributes
| Name | Description | Type | Default |
|---|---|---|---|
| model-value / v-model | binding value | Date | — |
| range | time range, including start time and end time. Start time must be start day of week, end time must be end day of week, the time span cannot exceed two months. | array | — |
Slots
| Name | Description | Type |
|---|---|---|
| date-cell | type indicates which month the date belongs, optional values are prev-month, current-month, next-month; isSelected indicates whether the date is selected; day is the formatted date in the format YYYY-MM-DD; date is date the cell represents | object |
| header | content of the Calendar header | object |
Exposes
| Name | Description | Type |
|---|---|---|
| selectedDay | currently selected date | object |
| pickDay | select a specific date | Function |
| selectDate | select date | Function |
| calculateValidatedDateRange | Calculate the validate date range according to the start and end dates | Function |
Type Declarations
Show declarations
type CalendarDateType =
| 'prev-month'
| 'next-month'
| 'prev-year'
| 'next-year'
| 'today'