Skip to content
目录

Time Picker 时间选择器

用于选择时间。

基础用法

html
<template>
  <dk-time-picker v-model="value" />
</template>

<script setup>
import { ref } from 'vue'

const value = ref('')
</script>
展开

属性

属性名说明类型默认值
model-value / v-model绑定值;当 value-format 为空时,默认绑定 Date;范围选择时为长度 2 的数组string / number / Date / Array''
readonly完全只读booleanfalse
disabled禁用booleanfalse
editable文本框可输入booleantrue
clearable是否显示清除按钮booleantrue
size输入框尺寸enum
placeholder非范围选择时占位内容string''
start-placeholder范围选择开始占位string''
end-placeholder范围选择结束占位string''
is-range是否为时间范围选择booleanfalse
range-separator范围选择分隔符string'-'
arrow-control是否使用箭头进行时间选择(否则使用滚轮)booleanfalse
format显示在输入框中的格式string'HH:mm:ss'
value-format绑定值的格式;为空时绑定值为 Datestring''
default-value打开面板时默认展示的时间Date / [Date, Date]
disabled-hours禁止选择部分小时选项() => number[]
disabled-minutes禁止选择部分分钟选项(hour: number) => number[]
disabled-seconds禁止选择部分秒选项(hour: number, minute: number) => number[]
popper-class下拉框的类名string''
popper-style下拉框自定义样式string / object''
popper-options自定义 popper 选项(预留)object{}
teleported是否将下拉列表传送到 bodybooleantrue
placement下拉框出现的位置string'bottom'
fallback-placements位置兜底列表string[]['bottom','top','right','left']
tabindex输入框的 tabindexstring / number0
aria-label等价于原生 input aria-label 属性string''
prefix-icon自定义前缀图标string'IconClock'
clear-icon自定义清除图标string'IconShanchu1'
id等价于原生 input id 属性string / string[]
name等价于原生 input name 属性string / string[]

事件

事件名说明回调参数
update:modelValuev-model 更新(value)
change用户确认选定的值时触发(value)
focusInput 获得焦点时触发(evt: FocusEvent)
blurInput 失去焦点时触发(evt: FocusEvent)
clear用户点击清空按钮时触发-
visible-change下拉列表出现/消失时触发(visible: boolean)

暴露

名称说明
focus使组件获取焦点
blur使组件失去焦点
handleOpen打开时间选择器弹窗
handleClose关闭时间选择器弹窗