Pro 时间选择器
用于选择或输入时刻(不含日期)。需要选日期请使用 DatePicker Pro,需要日期+时刻请使用 DateTimePicker Pro。
组件选型
| 组件 | 适用场景 |
|---|---|
| DatePicker Pro | 日期、日期范围 |
| DateTimePicker Pro | 日期 + 时刻 |
| TimePicker Pro(本文档) | 任意时刻、时刻范围 |
| DatePickerPanel Pro | 独立日期/时间面板 |
单点选择
任意时刻
默认滚轮选择时刻;arrow-control 改为箭头步进;面板可显示「此刻」按钮(与 show-now 等相关配置一致)。
默认
此刻:
箭头控制
轻量化
禁用部分时段
通过 disabledHours、disabledMinutes、disabledSeconds 限制可选范围。
范围选择
时刻范围 is-range
设置 is-range 选择开始与结束时刻,同样支持 arrow-control。
-
-
API
Attributes
| 参数 | 说明 | 类型 | 默认值 | Version |
|---|---|---|---|---|
| model-value / v-model | 绑定值,如果它是数组,长度应该是 2 | number / string / object | '' | |
| readonly | 完全只读 | boolean | false | |
| disabled | 禁用 | boolean | false | |
| editable | 文本框可输入 | boolean | true | |
| clearable | 是否显示清除按钮 | boolean | true | |
| size | 输入框尺寸 | enum | — | |
| placeholder | 非范围选择时的占位内容 | string | '' | |
| start-placeholder | 范围选择时开始日期的占位内容 | string | — | |
| end-placeholder | 范围选择时结束日期的占位内容 | string | — | |
| is-range | 是否为时间范围选择 | boolean | false | |
| arrow-control | 是否使用箭头进行时间选择 | boolean | false | |
| popper-class | TimePicker Pro 下拉框的类名 | string | '' | |
| teleported | 是否使用 teleport;为 true 时下拉层挂载到 append-to 指定位置 | boolean | true | |
| append-to | 下拉层挂载到哪个 DOM 元素 | string | — | |
| range-separator | 选择范围时的分隔符 | string | '-' | |
| format | 显示在输入框中的格式 | string see date formats | — | |
| default-value | 可选,选择器打开时默认显示的时间 | Date / object | — | |
| value-format | 可选,绑定值的格式。 不指定则绑定值为 Date 对象 | string 参考 日期格式 | — | |
| id | 等价于原生 input id 属性 | string / object | — | |
| name | 等价于原生 input name 属性 | string | '' | |
| aria-label a11y | 等价于原生 input aria-label 属性 | string | — | |
| prefix-icon | 自定义前缀图标;未设置时不显示 | string / Component | '' | |
| suffix-icon | 自定义后缀图标;未设置时默认为时钟图标 | string / Component | '' | |
| clear-icon | 自定义清除图标 | string / Component | CircleCloseFilled | |
| disabled-hours | 禁止选择部分小时选项 | Function | — | |
| disabled-minutes | 禁止选择部分分钟选项 | Function | — | |
| disabled-seconds | 禁止选择部分秒选项 | Function | — | |
| automatic-dropdown | 聚焦时是否自动展开面板 | boolean | true | |
| manual-input | 是否启用智能分块手动录入 | boolean | true | |
| save-on-blur | 无值时失焦是否写入当前时刻;false 时取消可恢复 | boolean | true | |
| persistent | 关闭后是否保留下拉 DOM | boolean | true | |
| popper-style | 下拉层样式 | object | — | |
| placement | 下拉层位置 | Placement | bottom-start | |
| fallback-placements | 下拉层备选位置 | array | 见 popper 默认 | |
| popper-options | popper.js 配置 | object | {} | |
| trigger-suffix | 仅点击后缀图标打开面板 | boolean | false | |
| tabindex | 输入框的 tabindex | string / number | 0 | |
| empty-values | 组件的空值配置 参考 config-provider | array | — | |
| value-on-clear | 清空选项的值 参考 config-provider | string / number / boolean / Function | — | |
| label a11y deprecated | 等价于原生 input aria-label 属性 | string | — | |
| plain | 朴素的 TimePicker Pro | boolean | false | V0.0.8 |
| emit-formatted-value | change 事件是否附带格式化字符串(第二参数) | boolean | false | V0.0.8 |
事件
| 事件名 | 说明 | 类型 |
|---|---|---|
| change | 用户确认选定的值时触发 | Function |
| blur | 在组件 Input 失去焦点时触发 | Function |
| focus | 在组件 Input 获得焦点时触发 | Function |
| clear | 可清空的模式下用户点击清空按钮时触发 | Function |
| visible-change | 当 TimePicker 的下拉列表出现/消失时触发 | Function |
暴露
| 名称 | 说明 | Type |
|---|---|---|
| focus | 使组件获取焦点 | Function |
| blur | 使组件失去焦点 | Function |
| handleOpen | 打开时间选择器弹窗 | Function |
| handleClose | 关闭时间选择器弹窗 | Function |
Copyright 2025 Winning Health 版权所有

