Time Picker 时间选择器

用于输入时间。

任意时间点

可选择任意时间。

默认可通过滚轮选择时间;设置 arrow-control 后也可使用箭头控件选择。

限制时间范围

可限制可选时间范围。

通过 disabledHoursdisabledMinutesdisabledSeconds 限制可选时间。

任意时间范围

可选择任意时间范围。

添加 is-range 可选择时间范围;范围模式下同样支持 arrow-control

To
To

面板底部按钮

底部支持「此刻」与「确定」按钮;点击「此刻」会选中当前时分秒,并与「确定」一致地关闭面板。

API

属性

名称说明类型默认值
model-value / v-model绑定值;若为数组,长度应为 2number / string / object''
readonly是否只读booleanfalse
disabled是否禁用booleanfalse
editable文本框是否可输入booleantrue
clearable是否显示清除按钮booleantrue
size输入框尺寸enum
placeholder非范围模式下的占位文本string''
start-placeholder范围模式下开始时间的占位文本string
end-placeholder范围模式下结束时间的占位文本string
is-range是否为时间范围选择booleanfalse
arrow-control是否使用箭头按钮选择时间booleanfalse
popper-class下拉框的自定义类名string''
popper-style下拉框的自定义样式string / object
popper-options自定义 Popper 选项,详见 popper.jsobject{}
fallback-placementsTooltip 可能出现的位置列表,详见 popper.jsarray['bottom', 'top', 'right', 'left']
placement下拉框位置Placementbottom
range-separator范围选择分隔符string'-'
format输入框中展示值的格式string 参见日期格式
default-value可选,日历的默认日期Date / array
value-format可选,绑定值的格式;未指定时绑定值为 Date 对象string 参见日期格式
id同原生 inputidstring / array
name同原生 inputnamestring''
aria-label a11y同原生 inputaria-labelstring
prefix-icon自定义前缀图标组件string / ComponentClock
clear-icon自定义清除图标组件string / ComponentCircleClose
disabled-hours指定不可选的小时数组Function
disabled-minutes指定不可选的分钟数组Function
disabled-seconds指定不可选的秒数组Function
teleported下拉是否挂载到 bodybooleantrue
tabindex输入框 tabindexstring / number0
empty-values组件的空值配置,参见 config-providerarray
value-on-clear清空时的返回值,参见 config-providerstring / number / boolean / Function
save-on-blur未选择值时,失焦是否用当前时间自动填充输入框booleantrue
show-now是否显示「此刻」按钮booleantrue
show-confirm是否显示确认按钮booleantrue
show-footer是否显示底部栏booleantrue

事件

名称说明类型
change用户确认值时触发Function
blur输入框失焦时触发Function
focus输入框聚焦时触发Function
clear可清空时点击清除图标触发Function
visible-change下拉出现/隐藏时触发Function

暴露

名称说明类型
focus聚焦时间选择器Function
blur失焦时间选择器Function
handleOpen打开时间选择器浮层Function
handleClose关闭时间选择器浮层Function

类型声明

显示类型声明
ts
type Placement =
  | 'top'
  | 'top-start'
  | 'top-end'
  | 'bottom'
  | 'bottom-start'
  | 'bottom-end'
  | 'left'
  | 'left-start'
  | 'left-end'
  | 'right'
  | 'right-start'
  | 'right-end'