element 开始日期小于等于结束日期
效果
开始日期小于等于结束日期
代码如下:
<el-date-picker
v-model="editLicenseData.start_time"
class="youxiaoqi"
type="date"
value-format="yyyy-MM-dd"
range-separator="至"
:picker-options="editDataStartDate"
placeholder="开始日期"
>
</el-date-picker>-
<el-date-picker
v-model="editLicenseData.end_time"
value-format="yyyy-MM-dd"
class="youxiaoqi"
type="date"
:picker-options="editDataEndDate"
range-separator="至"
placeholder="结束日期"
>
</el-date-picker>
data() {
return {
editLicenseData: {
start_time: '',
end_time: ''
},
editDataStartDate: {
disabledDate: (time) => {
if (this.editLicenseData.end_time) {
return time.getTime() > new Date(this.editLicenseData.end_time).getTime();
}
},
},
editDataEndDate: {
disabledDate: (time) => {
if (this.editLicenseData.start_time) {
return time.getTime() < new Date(this.editLicenseData.start_time).getTime() - 86400000;
}
}
},
}
}
网友评论