<FormItem label="销售时间" :label-width="80">
<DatePicker type="date" :options="startTime" @on-change="changeStartTime" v-model="formInline.startDate" style="width: 110px;"></DatePicker> -
<DatePicker type="date" :options="endTime" @on-change="changeEndTime" v-model="formInline.endDate" style="width: 110px;"></DatePicker>
</FormItem>
export default {
data (){
return {
formInline : {
startDate : '',
endDate : ''
},
startTime : {},
endTime : {},
}
}
}
changeStartTime(val){
this.formInline.startDate = val;
this.endTime = {
disabledDate: date => {
let startTime = this.formInline.startDate ? new Date(this.formInline.startDate).valueOf() - 1 * 24 * 60 * 60 * 1000 : '';
return date && (date.valueOf() < startTime);
}
}
},
changeEndTime(val){
this.formInline.endDate = val;
let endTime = this.formInline.endDate ? new Date(this.formInline.endDate).valueOf() : '';
this.startTime = {
disabledDate(date) {
return date && date.valueOf() > endTime;
}
}
},
转载自:(http://www.cnblogs.com/donaf/p/9753015.html)