Showing
1 changed file
with
11 additions
and
3 deletions
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-08-31 11:45:30 | 2 | * @Date: 2022-08-31 11:45:30 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-08-07 18:13:46 | 4 | + * @LastEditTime: 2024-08-08 18:39:36 |
| 5 | * @FilePath: /data-table/src/components/DatePickerField/index.vue | 5 | * @FilePath: /data-table/src/components/DatePickerField/index.vue |
| 6 | * @Description: 日期选择组件 | 6 | * @Description: 日期选择组件 |
| 7 | --> | 7 | --> |
| ... | @@ -110,13 +110,21 @@ onMounted(() => { | ... | @@ -110,13 +110,21 @@ onMounted(() => { |
| 110 | } | 110 | } |
| 111 | // 设置默认最大最小日期 | 111 | // 设置默认最大最小日期 |
| 112 | if (data_minvalue.length) { | 112 | if (data_minvalue.length) { |
| 113 | - const min = data_minvalue.split("-") | 113 | + const min = data_minvalue.split("-"); |
| 114 | + if (date_format === 'YYYY-MM') { | ||
| 115 | + minDate.value = new Date(+min[0], +min[1] - 1) | ||
| 116 | + } else { | ||
| 114 | minDate.value = new Date(+min[0], +min[1] - 1, +min[2]) | 117 | minDate.value = new Date(+min[0], +min[1] - 1, +min[2]) |
| 115 | } | 118 | } |
| 119 | + } | ||
| 116 | if (data_maxvalue.length) { | 120 | if (data_maxvalue.length) { |
| 117 | - const max = data_maxvalue.split("-") | 121 | + const max = data_maxvalue.split("-"); |
| 122 | + if (date_format === 'YYYY-MM') { | ||
| 123 | + maxDate.value = new Date(+max[0], +max[1] - 1) | ||
| 124 | + } else { | ||
| 118 | maxDate.value = new Date(+max[0], +max[1] - 1, +max[2]) | 125 | maxDate.value = new Date(+max[0], +max[1] - 1, +max[2]) |
| 119 | } | 126 | } |
| 127 | + } | ||
| 120 | }); | 128 | }); |
| 121 | 129 | ||
| 122 | const required = props.item.component_props.required; | 130 | const required = props.item.component_props.required; | ... | ... |
-
Please register or login to post a comment