时间控件优化 elementUI
选择起始时间不能在结束时间之后,结束时间不能在起始时间之前
<el-form-item label="起始时间:" class="sarch_form_item"><el-date-pickerv-model="formLabelAlign.dateStart"type="date"placeholder="选择起始时间":clearable=falseprefix-icon="el-icon-date"class="sarch_date_picker":picker-options="pickerStart"></el-date-picker></el-form-item><el-form-item label="结束时间:" class="sarch_form_item"><el-date-pickerv-model="formLabelAlign.dateEnd"type="date":clearable=falseplaceholder="选择结束时间"prefix-icon="el-icon-date"class="sarch_date_picker":picker-options="pickerEnd"></el-date-picker></el-form-item>
data () {return {formLabelAlign: {dateStart:'',dateEnd:''},pickerStart: {disabledDate: (time) => {if (this.formLabelAlign.dateEnd) {return time.getTime() > this.formLabelAlign.dateEnd}}},pickerEnd: {disabledDate: (time) => {if(this.formLabelAlign.dateStart){return time.getTime() < this.formLabelAlign.dateStart}}}}}