0.2.0 • Published 4 years ago

xy-time-select v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago
IEChromeFirefoxOperaSafari
IE 10+ ✔Chrome 31.0+ ✔Firefox 31.0+ ✔Opera 30.0+ ✔Safari 7.0+ ✔

NPM version node version npm download

xy-time-select

xy-time-select

时间选择器组件组件, 可从下拉列表选择时间,也可以直接输入

安装

# yarn
yarn add xy-time-select

使用例子

import React from "react";
import ReactDOM from "react-dom";
import TimeSelect from "xy-time-select";
ReactDOM.render(<TimeSelect />, container);

API

属性说明类型默认值
disabled是否禁用booleanfalse
value输入框值, 比如 01:00string
defaultValue输入框默认值string
placeholder占位符文本string
autoFocus自动焦点boolean
onChange输入框 change 事件(value: string) => void
popupClassName弹出内容类名string
stretch下拉列表是否宽度与输入框宽度对齐booleantrue
backfill是否键盘输入完再回填booleanfalse
delay防抖毫秒number200
dataSource数据源OptionConfig[] / string[] / React.ReactNode
customItem自定义渲染(props: CustomItemProps) => JSX.Element
onChange改变回调(value: string) => void
start开始时间,时间选择器开始时间范围, 比如 09:00string"00:00"
end结束时间,时间选择器开始时间范围, 比如 18:00string"23:59"
step间隔时间string"00:30"
min最小可选时间string
max最大可选时间string

开发

yarn run start

例子

http://localhost:6006

测试

yarn run test

开源许可

xy-time-select is released under the MIT license.