<FormItem label=""> <Row> <Col span="11"> <DatePicker type="date" :options="startTimeOptions" @on-change="startTimeChange" placeholder="开始时间" v-model="starttime"></DatePicker> </Col> <Col span="2" style="text-align: center">-</Col> <Col span="11"> <DatePicker type="date" :options="endTimeOptions" @on-change="endTimeChange" placeholder="结束时间" v-model="endtime"></DatePicker> </Col> </Row></FormItem>
/** * 设置开始时间 */ startTimeChange(e, index) { this.innerInfo.attackEnemySituationList[index].startTime = e; this.endTimeOptions = { disabledDate: (date) => { let startTime = this.innerInfo.attackEnemySituationList[index] .startTime ? new Date( this.innerInfo.attackEnemySituationList[index].startTime ).valueOf() : ""; return date && date.valueOf() < startTime && startTime != ""; }, }; }, /** * 设置结束时间 */ endTimeChange(e, index) { this.innerInfo.attackEnemySituationList[index].attackTime = e; let attackTime = this.innerInfo.attackEnemySituationList[index].attackTime ? new Date( this.innerInfo.attackEnemySituationList[index].attackTime ).valueOf() - 1 * 24 * 60 * 60 * 1000 : ""; this.startTimeOptions = { disabledDate(date) { return date && date.valueOf() > attackTime && attackTime != ""; }, }; },