mirror of https://github.com/ElemeFE/element
DatePicker: added prefix-icon and clear-icon (#9237)
* [DatePicker] Added the possibilitie to pass custom prefix and suffix icon class with same props as usual (prefix-icon and suffix-icon) * [DatePicker] Fixed error in previous commit and updated english documentation according to icon changes * Renamed suffix-icon to clear-icon, and updated english doc * Cleaned unnecessary linespull/9286/head
parent
ee5cd93db3
commit
cf3490cfea
|
@ -397,6 +397,8 @@ This feature is at alpha stage. Feedback welcome.
|
|||
| value-format | optional, format of binding value. If not specified, the binding value will be a Date object | string | year `yyyy`, month `MM`, day `dd`, hour `HH`, minute `mm`, second `ss`, AM/PM `A` | — |
|
||||
| name | same as `name` in native input | string | — | — |
|
||||
| unlink-panels | unlink two date-panels in range-picker | boolean | — | false |
|
||||
| prefix-icon | Custom prefix icon class | string | — | el-icon-date |
|
||||
| clear-icon | Custom clear icon class | string | — | el-icon-circle-close |
|
||||
|
||||
### Picker Options
|
||||
| Attribute | Description | Type | Accepted Values | Default |
|
||||
|
|
|
@ -256,6 +256,8 @@ DateTimePicker is derived from DatePicker and TimePicker. For a more detailed ex
|
|||
| value-format | optional, format of binding value. If not specified, the binding value will be a Date object | string | year `yyyy`, month `MM`, day `dd`, hour `HH`, minute `mm`, second `ss`, AM/PM `A` | — |
|
||||
| name | same as `name` in native input | string | — | — |
|
||||
| unlink-panels | unllink two date-panels in range-picker | boolean | — | false |
|
||||
| prefix-icon | Custom prefix icon class | string | — | el-icon-date |
|
||||
| clear-icon | Custom clear icon class | string | — | el-icon-circle-close |
|
||||
|
||||
### Picker Options
|
||||
| Attribute | Description | Type | Accepted Values | Default |
|
||||
|
|
|
@ -191,6 +191,8 @@ Can pick an arbitrary time range.
|
|||
| 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 | — |
|
||||
| value-format | optional, only for TimePicker, format of bounded value | string | hour `HH`, minute `mm`, second `ss`, AM/PM `A` | — |
|
||||
| name | same as `name` in native input | string | — | — |
|
||||
| prefix-icon | Custom prefix icon class | string | — | el-icon-time |
|
||||
| clear-icon | Custom clear icon class | string | — | el-icon-circle-close |
|
||||
|
||||
### Time Select Options
|
||||
| Attribute | Description | Type | Accepted Values | Default |
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<i slot="suffix"
|
||||
class="el-input__icon"
|
||||
@click="handleClickIcon"
|
||||
:class="{ 'el-icon-circle-close': showClose }"
|
||||
:class="[showClose ? '' + clearIcon : '']"
|
||||
v-if="haveTrigger">
|
||||
</i>
|
||||
</el-input>
|
||||
|
@ -69,7 +69,7 @@
|
|||
<i
|
||||
@click="handleClickIcon"
|
||||
v-if="haveTrigger"
|
||||
:class="{ 'el-icon-circle-close': showClose }"
|
||||
:class="[showClose ? '' + clearIcon : '']"
|
||||
class="el-input__icon el-range__close-icon">
|
||||
</i>
|
||||
</div>
|
||||
|
@ -309,6 +309,11 @@ export default {
|
|||
placeholder: String,
|
||||
startPlaceholder: String,
|
||||
endPlaceholder: String,
|
||||
prefixIcon: String,
|
||||
clearIcon: {
|
||||
type: String,
|
||||
default: 'el-icon-circle-close'
|
||||
},
|
||||
name: {
|
||||
default: '',
|
||||
validator
|
||||
|
@ -424,7 +429,7 @@ export default {
|
|||
},
|
||||
|
||||
triggerClass() {
|
||||
return this.type.indexOf('time') !== -1 ? 'el-icon-time' : 'el-icon-date';
|
||||
return this.prefixIcon || (this.type.indexOf('time') !== -1 ? 'el-icon-time' : 'el-icon-date');
|
||||
},
|
||||
|
||||
selectionMode() {
|
||||
|
|
Loading…
Reference in New Issue