zl程序教程

您现在的位置是:首页 >  其它

当前栏目

RangePicker @calendarChange @change区别

区别 Change
2023-09-27 14:21:58 时间
<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]); };