From 0a2e50e8042190b8a431c5ce5b66f74d8b36afa2 Mon Sep 17 00:00:00 2001 From: liweijie0812 <674416404@qq.com> Date: Wed, 28 Aug 2024 10:31:25 +0800 Subject: [PATCH] fix: resolve timeFormat (#4505) --- src/_common | 2 +- src/time-picker/panel/single-panel.tsx | 27 +++----------------------- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/src/_common b/src/_common index 1ae65fd277..f597d1bada 160000 --- a/src/_common +++ b/src/_common @@ -1 +1 @@ -Subproject commit 1ae65fd277c668c29481299772632fcec1c7645a +Subproject commit f597d1bada510e16cd9b3efd46000a674760a5ce diff --git a/src/time-picker/panel/single-panel.tsx b/src/time-picker/panel/single-panel.tsx index 07f381e310..1f9b21de57 100644 --- a/src/time-picker/panel/single-panel.tsx +++ b/src/time-picker/panel/single-panel.tsx @@ -6,15 +6,8 @@ import dayjs from 'dayjs'; import customParseFormat from 'dayjs/plugin/customParseFormat'; import { panelColProps } from './props'; -import { - EPickerCols, - TWELVE_HOUR_FORMAT, - TIME_FORMAT, - AM, - PM, - MERIDIEM_LIST, -} from '../../_common/js/time-picker/const'; -import { closestLookup } from '../../_common/js/time-picker/utils'; +import { EPickerCols, TWELVE_HOUR_FORMAT, AM, PM, MERIDIEM_LIST } from '../../_common/js/time-picker/const'; +import { closestLookup, getPickerCols } from '../../_common/js/time-picker/utils'; import { useCommonClassName, useConfig, usePrefixClass } from '../../hooks/useConfig'; dayjs.extend(customParseFormat); @@ -79,21 +72,7 @@ export default defineComponent({ ); onMounted(() => { - const match = format.value.match(TIME_FORMAT); - - const [, startCol, hourCol, minuteCol, secondCol, milliSecondCol, endCol] = match; - const { meridiem, hour, minute, second, milliSecond } = EPickerCols; - - const renderCol = [ - startCol && meridiem, - hourCol && hour, - minuteCol && minute, - secondCol && second, - milliSecondCol && milliSecond, - endCol && meridiem, - ].filter((v) => !!v); - - cols.value = renderCol; + cols.value = getPickerCols(format.value); }); // 获取每个时间的高度