<div class="item spec" v-else>
<div style="text-align: center;font-weight: 600; margin-top: 20px;">
出发
</div>
<el-form-item label="出发时间:" :verify="['NotNull']"
:prop="'travelInfos.' + index + '.evectionInfo[0].startTime'">
<el-date-picker v-model="item.evectionInfo[0].startTime" type="date" placeholder="选择日期"
value-format="yyyy-MM-dd" @change="val => {subsidyCount(val, index);}" :picker-options="pickerOptions0(index,0)">
</el-date-picker>
</el-form-item>
<el-form-item label="到达时间:" :verify="['NotNull']"
:prop="'travelInfos.' + index + '.evectionInfo[0].endTime'">
<el-date-picker v-model="item.evectionInfo[0].endTime" type="date" placeholder="选择日期"
value-format="yyyy-MM-dd" :picker-options="pickerOptions1(index,0)">
</el-date-picker>
</el-form-item>
</div>
export default {
data() {
return {
pickerOptions0: {},
pickerOptions1: {},
}
},
created(){
this.pickerOptions0 = function (index,flag) {
// 返程
let date = '',dateStart = ''
if(index==0) {
// 行程1
date = this.detailForm.travelInfos[index].evectionInfo[0].endTime
}else date = this.detailForm.travelInfos[index-1].evectionInfo[1].endTime
console.log(index,flag,date)
return {
disabledDate(time) {
if(index==0 && flag==0) return time.getTime() > Date.now() - 8.64e6;
else return time.getTime() < new Date(date).getTime() - 8.64e7 || time.getTime() > Date.now() - 8.64e6
}
}
}
this.pickerOptions1 = function (index,flag) {
let date = this.detailForm.travelInfos[index].evectionInfo[flag].startTime
return {
disabledDate(time) {
return time.getTime() <= new Date(date).getTime() - 8.64e7 || time.getTime() > Date.now() - 8.64e6;
}
}
}
},
}
elementui 时间日期选择器限制支持传参
最新推荐文章于 2023-10-24 10:01:37 发布