简体中文
DateTimePicker
约 352 字大约 1 分钟
2026-06-25
简介
日期时间选择器组件用于选择日期和时间。支持多种格式(年月日、时分秒)、自定义范围、默认值设置等特性。
使用方法
局部引入,在需要引入的页面或组件的index.json中配置。
"usingComponents": {
"dialog-center": "ava-ui/fxui/DialogCenter/DialogCenter"
}import dialogSet from "ava-ui/fxui/DialogCenter/DialogSet";
dialogSet.dateTimePicker.show({
type:"day|time",
success:function(res){
console.log(res)
}
});代码演示
01 组件类型
默认按钮
02 隐藏清空按钮
可设置 hideClearButton 参数来隐藏清空按钮
API
参数
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| type | 选择器类型 | string | day|time / day / time / year / month / quarter | day |
| starttime | 起始时间 | string | 格式如 2000-01-01 00:00 | 1900-01-01 00:00 |
| endtime | 结束时间 | string | 格式如 2030-12-31 23:59 | 2100-12-31 23:59 |
| backtime | 默认回显时间 | string | 格式如 2022-05-20 12:00 | 当前时间 |
| hideClearButton | 是否隐藏清空按钮 | boolean | true / false | false |
| beforeSuccess | 选择前校验回调 | function | 返回 true 阻止关闭 | - |
| success | 选择完成回调 | function | result, formatRes | - |
| close | 关闭回调 | function | - | - |
Events
| 事件名 | 说明 | 回调参数 |
|---|
