ant-design/components/time-picker/index.zh-CN.md
二货机器人 407a41a142
feat: New Picker (#20023)
* init generate

* basic style

* basic panel style

* update mode panel style

* update style

* generate More picker

* default clear icon

* chore: Update separator type

* feat: Add ranged start & end className

* update range style

* Add transition effect

* support size config

* adjust range style

* chore: Auto fill time by showTime

* auto set time by format

* update disabled style

* update seperator style

* ranges style

* support extra footer style

* remove useless test case
part is not usable anymore
part is already tested in rc-picker

* init calendar

* all demos

* fix calendar basic test

* fix time-picker test case

* update snapshot

* fix tooltip test case & lint

* fix locale & style lint

* fix compile

* fix style

* fix style lint

* fix calendar style

* update rc-picker version

* adjust style

* move picker placeholder into locale file

* update snapshot

* add hover style

* update picker version

* fix icon position & style

* update picker version

* update deps for pading

* fix: align of suffix

* feat: Year & Month support range effect

* adjust range style to support up-down placement

* update rc-picker

* update range picker style

* adjust extra footer line style

* update snapshot

* fix: Locale error

* fix: style lint

* fix: add missing button style deps

* update test case

* fix firefox additional white line style issue

* rollback demo

* fix ff additional blue color

* docs: Remove placeholder in demo

* rangepicker ranges is tag now

* connect start / end background color with picker range

* update deps

* update deps for fixing blur text issue

* hide start-end demo

* range hover style update

* hover range with ranged value

* black magic of inner hover style

* hover style of range adjust

* fix css select miss hit on DatePicker

* remove one eslint rule

* fade range hovered color

* week should alway not show the cell selection

* update style of selection

* update snapshot

* fix style

* add margin back

* update rc-picker deps

* update date & time picker & form style

* fix disabled demo & update form style

* update docs about allowEmpty

* hide arrow in time range picker

* add hover & focused style

* fix lint

* fix style & update snapshot

* raise disabled selector proirity

* fix disabled today border color

* extra footer provides an bottom line

* time picker hover support transition background

* add padding style

* fix Firefox not correct calculate inline-flex

* fix style

* fix week picker missing today border color

* rm useless padding

* Force padding to 0

* test coverage

* dedup eslint rule

* adjust logic to imporve coverage

* fix render cell logic
2019-12-11 23:32:19 +08:00

2.7 KiB

category subtitle type title
Components 时间选择框 数据录入 TimePicker

输入或选择时间的控件。

何时使用


当用户需要输入一个时间,可以点击标准输入框,弹出时间面板进行选择。

API


import moment from 'moment';
<TimePicker defaultValue={moment('13:30:56', 'HH:mm:ss')} />;
参数 说明 类型 默认值 版本
allowClear 是否展示清除按钮 boolean true
autoFocus 自动获取焦点 boolean false
className 选择器类名 string ''
clearText 清除按钮的提示文案 string clear
defaultOpenValue 当 defaultValue/value 不存在时,可以设置面板打开时默认选中的值 moment moment()
defaultValue 默认时间 moment
disabled 禁用全部操作 boolean false
disabledHours 禁止选择部分小时选项 function()
disabledMinutes 禁止选择部分分钟选项 function(selectedHour)
disabledSeconds 禁止选择部分秒选项 function(selectedHour, selectedMinute)
format 展示的时间格式 string "HH:mm:ss"
getPopupContainer 定义浮层的容器,默认为 body 上新建 div function(trigger)
hideDisabledOptions 隐藏禁止选择的选项 boolean false
hourStep 小时选项间隔 number 1
inputReadOnly 设置输入框为只读(避免在移动设备上打开虚拟键盘) boolean false
minuteStep 分钟选项间隔 number 1
open 面板是否打开 boolean false
placeholder 没有值的时候显示的内容 string "请选择时间"
popupClassName 弹出层类名 string ''
popupStyle 弹出层样式对象 object -
secondStep 秒选项间隔 number 1
suffixIcon 自定义的选择框后缀图标 ReactNode -
clearIcon 自定义的清除图标 ReactNode -
renderExtraFooter 选择框底部显示自定义的内容 () => ReactNode
use12Hours 使用 12 小时制,为 true 时 format 默认为 h:mm:ss a boolean false
value 当前时间 moment
onChange 时间发生变化的回调 function(time: moment, timeString: string): void
onOpenChange 面板打开/关闭时的回调 (open: boolean): void

方法

名称 描述 版本
blur() 移除焦点
focus() 获取焦点