mirror of
https://github.com/element-plus/element-plus.git
synced 2025-02-17 11:49:41 +08:00
docs(components): [calendar] (#10977)
* docs(components): [calendar] * Update calendar docs with new syntax. * Update description for calendar APIs. * chore: remove backquote for API names * chore: update scoped slots * chore: apply suggestion --------- Co-authored-by: JeremyWuuuuu <15975785+JeremyWuuuuu@users.noreply.github.com>
This commit is contained in:
parent
cc3cc854e8
commit
8c2a2a69dd
@ -45,16 +45,18 @@ The default locale of is English, if you need to use other languages, please che
|
||||
|
||||
Note, date time locale (month name, first day of the week ...) are also configured in localization.
|
||||
|
||||
## Attributes
|
||||
## API
|
||||
|
||||
| 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. | `[Date, Date]` | — |
|
||||
### Attributes
|
||||
|
||||
## Slots
|
||||
| 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]`[Date, Date]` | — |
|
||||
|
||||
| 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 | `{ type: 'prev-month' \| 'current-month' \| 'next-month', isSelected: boolean, day: string, date: Date }` |
|
||||
| `header` | content of the Calendar header | — |
|
||||
### 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]`{ data: { type: 'prev-month' \| 'current-month' \| 'next-month', isSelected: boolean, day: string, date: Date } }` |
|
||||
| header | content of the Calendar header | ^[object]`{ date: string }` |
|
||||
|
@ -18,9 +18,16 @@ const isValidRange = (range: unknown): range is [Date, Date] =>
|
||||
isArray(range) && range.length === 2 && range.every((item) => isDate(item))
|
||||
|
||||
export const calendarProps = buildProps({
|
||||
/**
|
||||
* @description binding value
|
||||
*/
|
||||
modelValue: {
|
||||
type: Date,
|
||||
},
|
||||
/**
|
||||
* @description 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.
|
||||
*/
|
||||
range: {
|
||||
type: definePropType<[Date, Date]>(Array),
|
||||
validator: isValidRange,
|
||||
|
Loading…
Reference in New Issue
Block a user