Skip to content

FxTimePicker 时间选择器

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

FxTimePicker 属于 @fx/components

任意时间选择

可选择任意时间。

默认可用鼠标滚轮选择时间,设置 arrow-control 后可使用箭头按钮选择。

限制时间范围

也可以限制时间范围。

通过 disabledHoursdisabledMinutesdisabledSeconds 限制可选时间范围。

任意时间范围

可选择一个时间范围。

添加 is-range 属性即可选择时间范围,arrow-control 在范围模式下同样支持。

扩展能力

以下为 FxTimePicker 在基础时间选择之外额外提供的能力。

时间格式

format 控制输入框显示格式(dayjs token),value-format 控制绑定值格式;未指定 value-format 时绑定 Date 对象。

禁用

disabled 完全禁用选择器(不弹层、不可编辑)。

API

Attributes

属性说明类型默认值
model-value / v-model绑定值,数组时长度为 2number | string | Date | [Date, Date] | [number, number] | [string, string]
readonly是否只读booleanfalse
disabled是否禁用booleanfalse
editable输入框是否可键入booleantrue
clearable是否显示清空按钮booleantrue
size输入框尺寸'large' | 'default' | 'small'
placeholder非范围模式的占位文本string
start-placeholder范围模式起始占位string
end-placeholder范围模式结束占位string
is-range是否选择时间范围booleanfalse
arrow-control是否使用箭头按钮选时间booleanfalse
popper-class下拉自定义类名string
popper-style下拉自定义样式string | object
popper-options透传浮层选项object{}
fallback-placements浮层备选位置列表Placement[]['bottom','top','right','left']
placement浮层位置Placementbottom
range-separator范围分隔符string'-'
format输入框显示格式string
default-value面板默认聚焦时间Date | [Date, Date]
value-format绑定值格式,未指定则绑定 Date 对象string
id原生 idstring | [string, string]
name原生 namestring | [string, string]
aria-label原生 aria-labelstring
prefix-icon自定义前缀图标string | Componentep:clock
clear-icon自定义清空图标string | Componentep:circle-close
disabled-hours禁用小时(role: string, comparingDate?: Dayjs) => number[]
disabled-minutes禁用分钟(hour: number, role: string, comparingDate?: Dayjs) => number[]
disabled-seconds禁用秒(hour: number, minute: number, role: string, comparingDate?: Dayjs) => number[]
teleported是否将下拉挂载到 bodybooleantrue
tabindex输入框 tabindexstring | number0
empty-values组件的空值列表array
value-on-clear清空时回填的值string | number | boolean | Function
save-on-blur未选值时聚焦是否自动填入当前时间booleantrue
validate-event是否触发表单校验booleantrue
automatic-dropdown聚焦输入框时自动展开下拉booleantrue

Events

事件名说明类型
change用户确认选值时触发(val) => void
blur输入框失焦时触发(e: FocusEvent) => void
focus输入框聚焦时触发(e: FocusEvent) => void
clear点击清空按钮时触发() => void
visible-change下拉显隐时触发(visible: boolean) => void

Exposes

方法说明类型
focus聚焦输入框() => void
blur失焦输入框() => void
handleOpen打开下拉() => void
handleClose关闭下拉() => void

类型声明

展开查看
ts
type Placement =
  | 'top'
  | 'top-start'
  | 'top-end'
  | 'bottom'
  | 'bottom-start'
  | 'bottom-end'
  | 'left'
  | 'left-start'
  | 'left-end'
  | 'right'
  | 'right-start'
  | 'right-end'