Skip to content

Commit

Permalink
feat: 代码调整
Browse files Browse the repository at this point in the history
  • Loading branch information
liweijie0812 committed Dec 3, 2023
1 parent 9bb1936 commit c834a2f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/time-picker/panel/time-picker-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default defineComponent({
const triggerScroll = ref(false);
const panelRef = ref();
const { globalConfig } = useConfig('timePicker');
const showNowTimeBtn = computed(() => !!steps.value.filter((v) => Number(v) > 1).length);
const showNowTimeBtn = computed(() => !!steps.value.filter((step) => Number(step) > 1).length);

const defaultValue = computed(() => {
const isStepsSet = showNowTimeBtn.value;
Expand Down Expand Up @@ -58,12 +58,12 @@ export default defineComponent({
const presetVal = typeof presetValue === 'function' ? presetValue() : presetValue;
if (typeof props.activeIndex === 'number') {
if (Array.isArray(presetVal)) {
props.onChange(presetVal[props.activeIndex]);
props.onChange?.(presetVal[props.activeIndex]);
} else {
log.error('TimePicker', `preset: ${props.presets} 预设值必须是数组!`);
}
} else {
props.onChange(presetVal);
props.onChange?.(presetVal);
}
};

Expand Down

0 comments on commit c834a2f

Please sign in to comment.