在使用element组件的时间选择器时,自带的清楚按钮清空的数据格式不正确,默认是清空为NULL,但是我需要的是空数组.
<el-date-picker v-model="searchTimeData" type="daterange" align="right" unlink-panels range-separator="|" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions" style="margin-left: 10px"> </el-date-picker>
增加watch及时清除数据为指定格式
watch: { searchTimeData(newValue) { if (newValue === null) { this.searchTimeData = []; console.log('searchTimeData was set to null, resetting to empty array'); } }, exportTime(newValue) { if (newValue === null) { this.exportTime = []; console.log('searchTimeData was set to null, resetting to empty array'); } } },
标签:picker,el,set,searchTimeData,清空,date,array,null,newValue From: https://www.cnblogs.com/fan-wang/p/18343300