mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-02 19:28:14 +08:00
feat(components): [date/time-picker] add id attribute to the inputs (#4972)
* feat(components): [date/time-picker] add id attribute to the inputs * docs(components): [date/time-picker] add id to attributes
This commit is contained in:
parent
f85621d209
commit
542ea5ee7e
@ -199,6 +199,7 @@ Note, date time locale (month name, first day of the week ...) are also configur
|
|||||||
| default-value | optional, default date of the calendar | Date | anything accepted by `new Date()` | — |
|
| default-value | optional, default date of the calendar | Date | anything accepted by `new Date()` | — |
|
||||||
| default-time | optional, the time value to use when selecting date range | Date[] | Array with length 2, each item is a Date. The first item for the start date and then second item for the end date | — |
|
| default-time | optional, the time value to use when selecting date range | Date[] | Array with length 2, each item is a Date. The first item for the start date and then second item for the end date | — |
|
||||||
| value-format | optional, format of binding value. If not specified, the binding value will be a Date object | string | see [date formats](/en-US/component/date-picker#date-formats) | — |
|
| value-format | optional, format of binding value. If not specified, the binding value will be a Date object | string | see [date formats](/en-US/component/date-picker#date-formats) | — |
|
||||||
|
| id | same as `id` in native input | string / array(string) | String `id="my-date"` or array `:id="['my-range-start', 'my-range-end']"` for date range | - |
|
||||||
| name | same as `name` in native input | string | — | — |
|
| name | same as `name` in native input | string | — | — |
|
||||||
| unlink-panels | unlink two date-panels in range-picker | boolean | — | false |
|
| unlink-panels | unlink two date-panels in range-picker | boolean | — | false |
|
||||||
| prefix-icon | custom prefix icon component | string / Component | — | Date |
|
| prefix-icon | custom prefix icon component | string / Component | — | Date |
|
||||||
|
@ -78,6 +78,7 @@ datetime-picker/default-time
|
|||||||
| range-separator | range separator | string | - | '-' |
|
| range-separator | range separator | string | - | '-' |
|
||||||
| default-value | optional, default date of the calendar | Date | anything accepted by `new Date()` | — |
|
| default-value | optional, default date of the calendar | Date | anything accepted by `new Date()` | — |
|
||||||
| default-time | the default time value after picking a date | non-range: Date / range: Date[] | non-range: a Date object, range: array of two Date objects, and the first item is for the start date and second for the end date. Time `00:00:00` will be used if not specified | — |
|
| default-time | the default time value after picking a date | non-range: Date / range: Date[] | non-range: a Date object, range: array of two Date objects, and the first item is for the start date and second for the end date. Time `00:00:00` will be used if not specified | — |
|
||||||
|
| id | same as `id` in native input | string / array(string) | String `id="my-datetime"` or array `:id="['my-range-start', 'my-range-end']"` for date range | - |
|
||||||
| name | same as `name` in native input | string | — | — |
|
| name | same as `name` in native input | string | — | — |
|
||||||
| unlink-panels | unllink two date-panels in range-picker | boolean | — | false |
|
| unlink-panels | unllink two date-panels in range-picker | boolean | — | false |
|
||||||
| prefix-icon | Custom prefix icon component | string | — | Date |
|
| prefix-icon | Custom prefix icon component | string | — | Date |
|
||||||
|
@ -29,30 +29,31 @@ time-picker/range
|
|||||||
|
|
||||||
## Attributes
|
## Attributes
|
||||||
|
|
||||||
| Attribute | Description | Type | Accepted Values | Default |
|
| Attribute | Description | Type | Accepted Values | Default |
|
||||||
| --------------------- | ------------------------------------------------------- | ------------------------------------------ | --------------------------------------------------------------------------------- | ----------- |
|
| --------------------- | ------------------------------------------------------- | ------------------------------------------ | ----------------------------------------------------------------------------------- | ----------- |
|
||||||
| model-value / v-model | binding value | Date | — | — |
|
| model-value / v-model | binding value | Date | — | — |
|
||||||
| readonly | whether TimePicker is read only | boolean | — | false |
|
| readonly | whether TimePicker is read only | boolean | — | false |
|
||||||
| disabled | whether TimePicker is disabled | boolean | — | false |
|
| disabled | whether TimePicker is disabled | boolean | — | false |
|
||||||
| editable | whether the input is editable | boolean | — | true |
|
| editable | whether the input is editable | boolean | — | true |
|
||||||
| clearable | whether to show clear button | boolean | — | true |
|
| clearable | whether to show clear button | boolean | — | true |
|
||||||
| size | size of Input | string | large / default / small | — |
|
| size | size of Input | string | large / default / small | — |
|
||||||
| placeholder | placeholder in non-range mode | string | — | — |
|
| placeholder | placeholder in non-range mode | string | — | — |
|
||||||
| start-placeholder | placeholder for the start time in range mode | string | — | — |
|
| start-placeholder | placeholder for the start time in range mode | string | — | — |
|
||||||
| end-placeholder | placeholder for the end time in range mode | string | — | — |
|
| end-placeholder | placeholder for the end time in range mode | string | — | — |
|
||||||
| is-range | whether to pick a time range | boolean | — | false |
|
| is-range | whether to pick a time range | boolean | — | false |
|
||||||
| arrow-control | whether to pick time using arrow buttons | boolean | — | false |
|
| arrow-control | whether to pick time using arrow buttons | boolean | — | false |
|
||||||
| align | alignment | left / center / right | left |
|
| align | alignment | left / center / right | left |
|
||||||
| popper-class | custom class name for TimePicker's dropdown | string | — | — |
|
| popper-class | custom class name for TimePicker's dropdown | string | — | — |
|
||||||
| range-separator | range separator | string | — | '-' |
|
| range-separator | range separator | string | — | '-' |
|
||||||
| format | format of the displayed value in the input box | string | see [date formats](/en-US/component/date-picker#date-formats) | HH:mm:ss |
|
| format | format of the displayed value in the input box | string | see [date formats](/en-US/component/date-picker#date-formats) | HH:mm:ss |
|
||||||
| default-value | optional, default date of the calendar | Date for TimePicker, string for TimeSelect | anything accepted by `new Date()` for TimePicker, selectable value for TimeSelect | — |
|
| default-value | optional, default date of the calendar | Date for TimePicker, string for TimeSelect | anything accepted by `new Date()` for TimePicker, selectable value for TimeSelect | — |
|
||||||
| name | same as `name` in native input | string | — | — |
|
| id | same as `id` in native input | string / array(string) | String `id="my-time"` or array `:id="['my-range-start', 'my-range-end']"` for range | - |
|
||||||
| prefix-icon | Custom prefix icon component | string / Component | — | Clock |
|
| name | same as `name` in native input | string | — | — |
|
||||||
| clear-icon | Custom clear icon component | string / Component | — | CircleClose |
|
| prefix-icon | Custom prefix icon component | string / Component | — | Clock |
|
||||||
| disabled-hours | To specify the array of hours that cannot be selected | function | — | — |
|
| clear-icon | Custom clear icon component | string / Component | — | CircleClose |
|
||||||
| disabled-minutes | To specify the array of minutes that cannot be selected | function(selectedHour) | — | — |
|
| disabled-hours | To specify the array of hours that cannot be selected | function | — | — |
|
||||||
| disabled-seconds | To specify the array of seconds that cannot be selected | function(selectedHour, selectedMinute) | — | — |
|
| disabled-minutes | To specify the array of minutes that cannot be selected | function(selectedHour) | — | — |
|
||||||
|
| disabled-seconds | To specify the array of seconds that cannot be selected | function(selectedHour, selectedMinute) | — | — |
|
||||||
|
|
||||||
## Events
|
## Events
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
<template #trigger>
|
<template #trigger>
|
||||||
<el-input
|
<el-input
|
||||||
v-if="!isRangeInput"
|
v-if="!isRangeInput"
|
||||||
|
:id="id"
|
||||||
v-clickoutside:[popperPaneRef]="onClickOutside"
|
v-clickoutside:[popperPaneRef]="onClickOutside"
|
||||||
:model-value="displayValue"
|
:model-value="displayValue"
|
||||||
:name="name"
|
:name="name"
|
||||||
@ -78,6 +79,7 @@
|
|||||||
<component :is="triggerIcon"></component>
|
<component :is="triggerIcon"></component>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<input
|
<input
|
||||||
|
:id="id && id[0]"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
:name="name && name[0]"
|
:name="name && name[0]"
|
||||||
:placeholder="startPlaceholder"
|
:placeholder="startPlaceholder"
|
||||||
@ -93,6 +95,7 @@
|
|||||||
<span class="el-range-separator">{{ rangeSeparator }}</span>
|
<span class="el-range-separator">{{ rangeSeparator }}</span>
|
||||||
</slot>
|
</slot>
|
||||||
<input
|
<input
|
||||||
|
:id="id && id[1]"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
:name="name && name[1]"
|
:name="name && name[1]"
|
||||||
:placeholder="endPlaceholder"
|
:placeholder="endPlaceholder"
|
||||||
|
@ -6,6 +6,9 @@ import type { Options } from '@popperjs/core'
|
|||||||
import type { ComponentSize } from '@element-plus/utils/types'
|
import type { ComponentSize } from '@element-plus/utils/types'
|
||||||
|
|
||||||
export const timePickerDefaultProps = {
|
export const timePickerDefaultProps = {
|
||||||
|
id: {
|
||||||
|
type: [Array, String],
|
||||||
|
},
|
||||||
name: {
|
name: {
|
||||||
type: [Array, String],
|
type: [Array, String],
|
||||||
default: '',
|
default: '',
|
||||||
|
Loading…
Reference in New Issue
Block a user