Skip to content

Commit

Permalink
feat(datepicker): support multiple
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn committed Jan 22, 2025
1 parent 5ebfadf commit 5590e78
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/date-picker/hooks/useSingle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ref, computed, watch } from 'vue';
import dayjs from 'dayjs';
import omit from 'lodash/omit';

import { useTNodeJSX } from '../../hooks/tnode';
import { useDisabled } from '../../hooks/useDisabled';
import { usePrefixClass } from '../../hooks/useConfig';
import { TdDatePickerProps, DateValue } from '../type';
Expand All @@ -19,7 +18,6 @@ import { useReadonly } from '../../hooks/useReadonly';
export default function useSingle(props: TdDatePickerProps) {
const COMPONENT_NAME = usePrefixClass('date-picker');
const disabled = useDisabled();
const renderTNodeJSX = useTNodeJSX();

const inputRef = ref();
const isReadOnly = useReadonly();
Expand All @@ -38,7 +36,11 @@ export default function useSingle(props: TdDatePickerProps) {
const popupVisible = ref(false);
const isHoverCell = ref(false);
// 未真正选中前可能不断变更输入框的内容
const inputValue = ref(formatDate(value.value, { format: formatRef.value.format }));
const inputValue = ref(
props.multiple
? formatDate(value.value, { format: formatRef.value.format }) || []
: formatDate(value.value, { format: formatRef.value.format }),
);

// input 设置
const inputProps = computed(() => {
Expand Down

0 comments on commit 5590e78

Please sign in to comment.