Skip to content
目录

Date Picker 日期选择器

用于选择日期(单选)。由输入框触发下拉日期面板,选择后回填 YYYY-MM-DD

基础用法

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

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

const value = ref('2026-01-29')
</script>
展开

禁用

html
<template>
  <dk-date-picker v-model="value" disabled />
</template>
展开

可清空(clearable)

html
<template>
  <dk-date-picker v-model="value" clearable />
</template>
展开

属性

属性名说明类型默认值
model-value / v-model绑定值(YYYY-MM-DD)string''
disabled是否禁用booleanfalse
clearable是否可清空booleantrue
placeholder占位文本string'请选择日期'
width输入框宽度string'240px'
panel-width面板宽度string'320px'
first-day-of-week一周起始日(0-6)number0
disabled-date禁用日期(返回 true 表示禁用)(date: Date) => boolean-
shortcuts快捷选项{ text: string; value: string | Date | (() => string | Date) }[][]

事件

事件名说明回调参数
update:modelValuev-model 更新(value: string)
change值变化时触发(value: string)
clear清空时触发-
visible-change面板显示状态变化(visible: boolean)
panel-change面板月份切换({ year: number; month: number })

Contributors

Mr.Fan