feat(components): [date-picker] add show-now prop (#18625)

This commit is contained in:
btea 2024-10-23 08:53:48 +08:00 committed by GitHub
parent 1c1b2743a1
commit 60b899d9bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 1 deletions

View File

@ -111,6 +111,7 @@ datetime-picker/custom-icon
| teleported | whether datetime-picker dropdown is teleported to the body | ^[boolean] | true | | teleported | whether datetime-picker dropdown is teleported to the body | ^[boolean] | true |
| empty-values ^(2.7.0) | empty values of component, [see config-provider](/en-US/component/config-provider#empty-values-configurations) | ^[array] | — | | empty-values ^(2.7.0) | empty values of component, [see config-provider](/en-US/component/config-provider#empty-values-configurations) | ^[array] | — |
| value-on-clear ^(2.7.0) | clear return value, [see config-provider](/en-US/component/config-provider#empty-values-configurations) | ^[string] / ^[number] / ^[boolean] / ^[Function] | — | | value-on-clear ^(2.7.0) | clear return value, [see config-provider](/en-US/component/config-provider#empty-values-configurations) | ^[string] / ^[number] / ^[boolean] / ^[Function] | — |
| show-now ^(2.8.7) | whether to show the now button | ^[boolean] | true |
## Events ## Events

View File

@ -170,7 +170,7 @@
</div> </div>
<div v-show="footerVisible" :class="ppNs.e('footer')"> <div v-show="footerVisible" :class="ppNs.e('footer')">
<el-button <el-button
v-show="!isMultipleType" v-show="!isMultipleType && showNow"
text text
size="small" size="small"
:class="ppNs.e('link-btn')" :class="ppNs.e('link-btn')"

View File

@ -57,6 +57,10 @@ export const panelSharedProps = buildProps({
}, },
dateFormat: String, dateFormat: String,
timeFormat: String, timeFormat: String,
showNow: {
type: Boolean,
default: true,
},
} as const) } as const)
export const panelRangeSharedProps = buildProps({ export const panelRangeSharedProps = buildProps({

View File

@ -151,6 +151,7 @@
:unlink-panels="unlinkPanels" :unlink-panels="unlinkPanels"
:type="type" :type="type"
:default-value="defaultValue" :default-value="defaultValue"
:show-now="showNow"
@pick="onPick" @pick="onPick"
@select-range="setSelectionRange" @select-range="setSelectionRange"
@set-picker-option="onSetPickerOption" @set-picker-option="onSetPickerOption"

View File

@ -227,6 +227,13 @@ export const timePickerDefaultProps = buildProps({
}, },
...useEmptyValuesProps, ...useEmptyValuesProps,
...useAriaProps(['ariaLabel']), ...useAriaProps(['ariaLabel']),
/**
* @description whether to show the now button
*/
showNow: {
type: Boolean,
default: true,
},
} as const) } as const)
export type TimePickerDefaultProps = ExtractPropTypes< export type TimePickerDefaultProps = ExtractPropTypes<