UNPKG

@daysnap/horn-ui

Version:

hron ui

45 lines (42 loc) 1.25 kB
import type { ExtractPropTypes, PropType } from 'vue' import type { DatePickerColumnType, PickerOption } from 'vant' import { makeArrayProp, makeStringProp } from '../utils' export const horDatePickerProps = { columnsType: { type: Array as PropType<DatePickerColumnType[]>, default: () => ['year', 'month', 'day'], }, minDate: { type: Date, }, maxDate: { type: Date, }, title: makeStringProp(''), confirmButtonText: makeStringProp('确认'), cancelButtonText: makeStringProp('取消'), formatter: { type: Function as PropType<(type: string, val: PickerOption) => PickerOption>, default: (type: string, val: PickerOption) => { if (type === 'year') { val.text += '年' } if (type === 'month') { val.text += '月' } if (type === 'day') { val.text += '日' } return val }, }, filter: { type: Function as PropType<(columnType: string, options: PickerOption[]) => PickerOption[]>, }, modelValue: { type: [Array, String, Date] as PropType<string[] | string | Date>, default: new Date(), }, valueFormat: makeStringProp('yyyy/MM/dd'), } export type HorDatePickerProps = ExtractPropTypes<typeof horDatePickerProps>