RangePicker @calendarChange @change区别
<RangePicker :bordered="false" allowClear :placeholder="['开始时间', '结束时间']" @calendarChange="onCalenderChange" @change="onRangeChange" />
@calendarChange:只要点击了一个日期,就会触发。
@change:只有选择了二个日期才会触发。
import { RangePickerValue } from 'ant-design-vue/lib/date-picker/interface';
const onCalenderChange = (dates) => { let startdate = formatToDate(dates[0]); let enddate = formatToDate(dates[1]); console.log('onCalenderChange', startdate, enddate); } const onRangeChange = (date: RangePickerValue, dateString: [string, string]) => { console.log('change:', dateString[0], dateString[1]); };
道法自然