question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[comp: TimePicker] add TimePicker component

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

TimePicker

What does the proposed API look like?

timePicker props

名称 说明 类型 默认值 全局配置 备注
v-model:value 当前选择的时间 Date - - -
control 控件控制器 string|AbstractControl - - 当存在 control 时, 控件将由 AbstractControl 完全控制,此时 value 会失效
format 展示的格式 string HH:mm:ss - 1. format的格式参考dayjs
2.如果传入的值有小写的h,如hh:mm:ss、hh:mm,会自动在后面加上a,变成hh:mm:ss a和hh:mm a,代表开启12小时进制
3. 会根据format的内容进行选项的展示,如HH:mm则不展示秒的选项
placeholder 值为空时展示的提示 string 请选择时间 - -
disabled 禁用全部操作 boolean false - -
readonly 只读状态 boolean false - -
clearable 是否展示清除按钮 boolean true -
autofocus 自动获取焦点 boolean false - -
borderless 是否为无边框 boolean false -
suffix 后缀图标 string clock-circle -
clearIcon 清除按钮图标 string close-circle -
clearText hover到clearIcon上,显示的title string clear -
size 尺寸大小 large|medium|small medium -
v-model:open 是否打开picker boolean false - -
disabledHours 禁用部分小时选项 ()=>number[] () => [] - -
disabledMinutes 禁用部分分钟选项 (selectedHour: number)=>number[] () => [] - -
disabledSeconds 禁用部分秒选项 (selectedHour: number, selectedMinute: number)=>number[] () => [] - -
hideDisabledOptions 隐藏禁止选择的options boolean false - -
hourStep 小时选项的间隔 number 1 - -
minuteStep 分钟选项的间隔 number 1 - -
secondStep 秒选项的间隔 number 1 - -
defalutPickerValue 打开面板时默认高亮的值 Date - - 如果value不为空,则高亮value的值
overlayClassName 浮层的类名 string - - -

timePicker slots

名称 说明 备注
suffix 后缀图标 -
clearIcon 清空图标 -
pickerFooter 自定义选择面板底部内容 -

timePicker events

名称 说明 参数类型 备注
change 选择的值发生改变 (time: Date) => void -
clear 点击清空图标后 (evt: MouseEvent) => void -
focus focus时触发 () => void -
blur blur时触发 () => void -

timeRangePicker props

timeRangePicker拥有timePicker的所有props、events、slots,只有下面的内容有所区别

名称 说明 类型 默认值 全局配置 备注
v-model:value 当前选择的时间范围 [Date, Date] - - -
defaultPickerValue 打开面板时默认高亮的值 [Date, Date] - - 如果value不为空,则高亮value的值
separator 分割符号 string -
placeholder 选择器没有值的时候展示的提示 [string, string] [开始时间,结束时间] - -
disabled 设置选择器为禁用,可选择设置开始方或者结束方 boolean | [boolean, boolean] false - -
readonly 设置选择器为只读状态,可选择设置开始方或者结束方 boolean | [boolean, boolean] false - -

组件架构设计: image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:63 (63 by maintainers)

github_iconTop GitHub Comments

1reaction
LaamGinghongcommented, Mar 17, 2021

那我没什么问题了,两个组件整理成多个表格,期待你的实现

0reactions
jackson-yyycommented, Mar 20, 2021

我的意思是用重载,这样类型校验的时候会避免这两个props同时存在,避免调用方传了value又传control

奥明白你意思了,我到时候注意下

应该不行,参考下 input 组件,使用 useValueAccessor 就可以管理 value 和 control

好,我直接参考input组件写吧

Read more comments on GitHub >

github_iconTop Results From Across the Web

COMPEON/timepicker: Simple time picker using React - GitHub
Simple time picker component built with react and styled-components. Screenshot. Installation. yarn add @compeon-os/timepicker.
Read more >
Time Picker - Components - Twilio Paste
The Time Picker component should include the base TimePicker, along with supporting elements to compose an input field that gives users the context...
Read more >
Getting started with Angular TimePicker component - Syncfusion
This section briefly explains how to create a simple TimePicker component, and configure its available functionalities in Angular by using quickstart seed ...
Read more >
ReactJS Blueprint TimePicker Component - GeeksforGeeks
TimePicker Component allows the user to specify a time. We can use the following approach in ReactJS to use the ReactJS Blueprint TimePicker...
Read more >
Time Picker | Components | Vaadin Docs
Time Picker is an input field for entering or selecting a specific time.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found