hookehuyr

fix 时间控件显示最大最小时间优化

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-03 20:36:39 4 + * @LastEditTime: 2024-08-09 11:49:07
5 * @FilePath: /data-table/src/components/TimePickerField/index.vue 5 * @FilePath: /data-table/src/components/TimePickerField/index.vue
6 * @Description: 时间选择组件 6 * @Description: 时间选择组件
7 --> 7 -->
...@@ -24,12 +24,7 @@ ...@@ -24,12 +24,7 @@
24 :border="false" 24 :border="false"
25 /> 25 />
26 <van-popup v-model:show="showPicker" position="bottom"> 26 <van-popup v-model:show="showPicker" position="bottom">
27 - <van-time-picker 27 + <van-time-picker v-model="currentTime" :min-time="minTime" :max-time="maxTime" title="请选择时间" :columns-type="columns_type" @confirm="onConfirm" @cancel="showPicker = false"
28 - v-model="currentTime"
29 - title="请选择时间"
30 - :columns-type="columns_type"
31 - @confirm="onConfirm"
32 - @cancel="showPicker = false"
33 /> 28 />
34 </van-popup> 29 </van-popup>
35 </div> 30 </div>
...@@ -66,6 +61,10 @@ const onConfirm = ({ selectedValues, selectedOptions }) => { ...@@ -66,6 +61,10 @@ const onConfirm = ({ selectedValues, selectedOptions }) => {
66 }; 61 };
67 62
68 const columns_type = ref([]); 63 const columns_type = ref([]);
64 +
65 +const minTime = ref()
66 +const maxTime = ref()
67 +
69 const date_format = props.item.component_props.data_dateformat; // HH:mm=时分,HH:mm:ss=时分秒 68 const date_format = props.item.component_props.data_dateformat; // HH:mm=时分,HH:mm:ss=时分秒
70 onMounted(() => { 69 onMounted(() => {
71 // 根据默认值时间调整显示 70 // 根据默认值时间调整显示
...@@ -95,6 +94,13 @@ onMounted(() => { ...@@ -95,6 +94,13 @@ onMounted(() => {
95 currentTime.value = [Hour, Minute, Second]; 94 currentTime.value = [Hour, Minute, Second];
96 break; 95 break;
97 } 96 }
97 + // 设置默认最大最小时间
98 + if (data_minvalue) {
99 + minTime.value = data_minvalue;
100 + }
101 + if (data_maxvalue) {
102 + maxTime.value = data_maxvalue;
103 + }
98 }); 104 });
99 105
100 const required = props.item.component_props.required; 106 const required = props.item.component_props.required;
......