element-ui时间选择器中设置结束时间必须大于开始时间
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
免费下载资源
·
<el-form-item label="开始时间" prop="startTime">
<el-date-picker
v-model="dataForm.startTime"
type="date"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
placeholder="选择日期"
:picker-options="pickerOptionsStart"
>
</el-date-picker>
</el-form-item>
<el-form-item label="结束时间" prop="endTime">
<el-date-picker
v-model="dataForm.endTime"
type="date"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
placeholder="选择日期"
:picker-options="pickerOptionsEnd"
>
</el-date-picker>
</el-form-item>
data () {
return {
dataForm: {
startTime:'',
endTime:''
},
pickerOptionsStart: {
disabledDate: time => {
let endDateVal = this.dataForm.endTime;
if (endDateVal) {
return time.getTime() > new Date(endDateVal).getTime();
}
}
},
pickerOptionsEnd: {
disabledDate: time => {
let beginDateVal = this.dataForm.startTime;
if (beginDateVal) {
return (time.getTime()<new Date(beginDateVal).getTime()-1*24*60*60*1000
);
}
}
}
}
},
GitHub 加速计划 / eleme / element
54.06 K
14.63 K
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:3 个月前 )
c345bb45
7 个月前
a07f3a59
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update table.md
* Update transition.md
* Update popover.md 7 个月前
更多推荐
已为社区贡献3条内容
所有评论(0)