时间选择器

用于时间输入的时间选择器。

任意时间点

可以选择任意时间。

默认情况下,你可以通过鼠标滚轮选择时间;当设置了 arrow-control 属性时,你可以通过上下箭控制时间。

限制时间范围

你也可以限制时间范围。

通过指定 disabledHoursdisabledMinutesdisabledSeconds 来限制时间范围。

任意时间范围

可以选择任意时间范围。

通过添加 is-range 属性可以选择时间范围。此外,在范围选择模式下也支持 arrow-control

API

属性

名称描述类型默认值
model-value / v-model绑定值,如果它是数组,长度应该是 2number / string / object''
只读时间选择器是否只读booleanfalse
disabled时间选择器是否禁用booleanfalse
可编辑输入框是否可编辑booleantrue
可清空是否显示清除按钮booleantrue
size输入框尺寸枚举
占位符非范围选择时的占位内容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-placements 2.8.4文字提示可能出现的位置列表 popper.jsarray['bottom', 'top', 'right', 'left']
placement 2.8.4下拉框出现的位置位置bottom
range-separator选择范围时的分隔符string'-'
format输入框中显示值的格式string 查看 日期格式
default-value可选,选择器打开时默认显示的时间Date / array
value-format可选,绑定值的格式。 如果未指定,则绑定值为 Date 对象string 查看 日期格式
id与原生 input 的 `id` 属性相同string / array
名称与原生输入框的 `name` 相同string''
aria-label a11y 2.7.2与原生输入框的 `aria-label` 相同string
前缀图标自定义前缀图标组件string / Component时钟
clear-icon自定义清空图标组件string / ComponentCircleClose
disabled-hours指定不可选的小时数组Function
disabled-minutes指定不可选的分钟数组Function
disabled-seconds指定不可选的秒数数组Function
teleported时间选择器下拉菜单是否传送到 body 元素booleantrue
tabindex输入框的 tabindexstring / number0
empty-values 2.7.0组件的空值,请参阅 config-providerarray
value-on-clear 2.7.0清空时的返回值,请参阅 config-providerstring / number / boolean / Function
save-on-blur 2.13.4当没有选择值时,在聚焦时是否用当前时间自动填充输入框booleantrue
label a11y 已废弃与原生输入框的 `aria-label` 相同string

事件

名称描述类型
change用户确认值时触发Function
blur在 Input 失去焦点时触发Function
focus在 Input 获得焦点时触发Function
clear 2.7.7可清空时间选择器中点击清空图标时触发Function
visible-change时间选择器下拉菜单出现/隐藏时触发Function

暴露

名称描述类型
focus聚焦时间选择器组件Function
blur失焦时间选择器组件Function
handleOpen 2.2.16打开时间选择器浮层Function
handleClose 2.2.16关闭时间选择器浮层Function

类型声明

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

来源

组件样式文档

贡献者