import{ax as l,al as c,z as m,A as n,B as d,R as a,b2 as i,O as e,J as o}from"./chunks/framework.DkLJC2NO.js";const T=JSON.parse('{"title":"DateTimePicker 日期时间选择器","description":"","frontmatter":{},"headers":[],"relativePath":"form-config/fields/datetime-picker.md","filePath":"form-config/fields/datetime-picker.md"}'),s={name:"form-config/fields/datetime-picker.md"};function h(p,t,f,b,u,k){const r=c("demo-block");return n(),m("div",null,[t[4]||(t[4]=d("h1",{id:"datetimepicker-日期时间选择器",tabindex:"-1"},[e("DateTimePicker 日期时间选择器 "),d("a",{class:"header-anchor",href:"#datetimepicker-日期时间选择器","aria-label":'Permalink to "DateTimePicker 日期时间选择器"'},"​")],-1)),t[5]||(t[5]=d("p",null,"在同一个选择器里选择日期和时间",-1)),t[6]||(t[6]=d("h2",{id:"基础用法",tabindex:"-1"},[e("基础用法 "),d("a",{class:"header-anchor",href:"#基础用法","aria-label":'Permalink to "基础用法"'},"​")],-1)),a(r,{type:"form",config:[{type:"datetime",name:"dateTime",text:"日期时间选择器"}]},{source:o(()=>[...t[0]||(t[0]=[d("p",null,[e(" 通过设置 "),d("code",null,"type: 'datetime'"),e(" 使用日期时间选择器,可以同时选择日期和时间。 ")],-1)])]),_:1}),t[7]||(t[7]=d("h2",{id:"带占位符",tabindex:"-1"},[e("带占位符 "),d("a",{class:"header-anchor",href:"#带占位符","aria-label":'Permalink to "带占位符"'},"​")],-1)),a(r,{type:"form",config:[{type:"datetime",name:"dateTime",text:"日期时间选择器",placeholder:"请选择日期时间"}]},{source:o(()=>[...t[1]||(t[1]=[d("p",null,[e(" 通过 "),d("code",null,"placeholder"),e(" 属性设置输入框的占位文本。 ")],-1)])]),_:1}),t[8]||(t[8]=d("h2",{id:"禁用状态",tabindex:"-1"},[e("禁用状态 "),d("a",{class:"header-anchor",href:"#禁用状态","aria-label":'Permalink to "禁用状态"'},"​")],-1)),a(r,{type:"form",config:[{type:"datetime",name:"dateTime",text:"日期时间选择器",disabled:()=>!0}]},{source:o(()=>[...t[2]||(t[2]=[d("p",null,[e(" 通过 "),d("code",null,"disabled"),e(" 属性禁用日期时间选择器,支持布尔值或函数。 ")],-1)])]),_:1}),t[9]||(t[9]=i('

日期格式

使用 format 指定输入框的格式;使用 valueFormat 指定绑定值的格式。

默认情况下,组件接受并返回格式化后的字符串。以下为可用的格式化字串,以 UTC 2017年1月2日 03:04:05 为例:

WARNING

请注意大小写

格式含义备注举例
YYYY2017
M不补01
MM01
D不补02
DD02
H小时24小时制;不补03
HH小时24小时制03
h小时12小时制,须和 Aa 使用;不补03
hh小时12小时制,须和 Aa 使用03
m分钟不补04
mm分钟04
s不补05
ss05
AAM/PMformat 可用,大写AM
aam/pmformat 可用,小写am
xJS时间戳(毫秒)valueFormat 可用1483326245000
XUnix时间戳(秒)valueFormat 可用1483326245
',5)),a(r,{type:"form",config:[{type:"datetime",name:"dateTime",text:"日期时间选择器",format:"YYYY-MM-DD HH:mm",valueFormat:"x"}]},{source:o(()=>[...t[3]||(t[3]=[d("p",null,[e(" 自定义格式化:显示格式为 "),d("code",null,"YYYY-MM-DD HH:mm"),e(",绑定值格式为时间戳。 ")],-1)])]),_:1}),t[10]||(t[10]=i('

Attributes

参数说明类型可选值默认值
name绑定值的字段名string
text表单标签string
placeholder输入框占位文本string
disabled是否禁用boolean / FilterFunctionfalse
format显示在输入框中的格式string日期格式YYYY/MM/DD HH:mm:ss
valueFormat绑定值的格式string日期格式YYYY/MM/DD HH:mm:ss
defaultTime选择日期后的默认时间值Date
onChange值变化时触发的函数OnChangeHandler
',2))])}const x=l(s,[["render",h]]);export{T as __pageData,x as default};