import { defineComponent, ref, watch } from 'vue'; import styles from './index.module.less'; import { NIcon, NImage, NDatePicker } from 'naive-ui'; import dateIcons from './images/dateIcon.png'; import disDate from './images/disDate.png'; export default defineComponent({ name: 'CDatePicker', props: { type: { type: String, default: 'daterange' }, separator: { type: String, default: '-' }, timerValue: { type: Array, default: [] as any } }, setup(props, { emit, attrs }) { const isFocus = ref(false); const timer = ref(null as any); const updateTimer = () => { console.log('更新日期', timer.value); emit('update:value', timer.value); }; timer.value = props.timerValue && props.timerValue.length > 0 ? props.timerValue : null; watch( () => props.timerValue, (value: any) => { timer.value = value && value.length ? value : null; } ); return () => ( <>
{ isFocus.value = true; }} onBlur={() => { isFocus.value = false; }} v-slots={{ 'date-icon': () => ( <> ) }}>
); } });