TimePicker 时间选择器

用于选择或输入日期

TIP

在 SSR 场景下,您需要将组件包裹在 <client-only></client-only> 之中 (如: Nuxt) 和 SSG (e.g: VitePress).

任意时间点

可以选择任意时间

限制时间选择范围

您也可以限制时间选择范围。

任意时间范围

可选择任意的时间范围

TimePicker 属性

属性名说明类型可选值默认值
model-value / v-model绑定值,如果它是数组,长度应该是 2Date / number / string / Array
readonly完全只读booleanfalse
disabled禁用booleanfalse
editable文本框可输入booleantrue
clearable是否显示清除按钮booleantrue
size输入框尺寸stringlarge / default / small
placeholder非范围选择时的占位内容string
start-placeholder范围选择时开始日期的占位内容string
end-placeholder范围选择时结束日期的占位内容string
is-range是否为时间范围选择booleanfalse
arrow-control是否使用箭头进行时间选择booleanfalse
popper-classTimePicker 下拉框的类名string
range-separator选择范围时的分隔符string'-'
format显示在输入框中的格式string请查看 date formatsHH:mm:ss
default-value可选,选择器打开时默认显示的时间Date / [Date, Date]
id等价于原生 input id 属性string / [string, string]-
name等价于原生 input name 属性string
prefix-icon自定义前缀图标string | ComponentClock
clear-icon自定义清除图标string | ComponentCircleClose
disabled-hours禁止选择部分小时选项function
disabled-minutes禁止选择部分分钟选项Function(selectedHour)
disabled-seconds禁止选择部分秒选项Function(selectedHour, selectedMinute)
teleported是否将 popover 的下拉列表镜像至 body 元素booleantrue / falsetrue

TimePicker 事件

事件名说明回调参数
change用户确认选定的值时触发(val: typeof v-model)
blur在组件 Input 失去焦点时触发(e: FocusEvent)
focus在组件 Input 获得焦点时触发(e: FocusEvent)
visible-change当 TimePicker 的下拉列表出现/消失时触发(visibility: boolean)

TimePicker 方法

方法名说明参数
focus使 input 获取焦点
blur使 input 失去焦点
handleOpen打开时间选择器弹窗
handleClose关闭时间选择器弹窗

源代码

组件文档

贡献者