element ui实现起始时间不能大于结束时间
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
免费下载资源
·
element ui实现起始时间不能大于结束时间
<template>
<div class="app-container">
<el-date-picker v-model="formItem.palnStartTime" type="datetime" placeholder="选择日期" size="small" value-format="yyyy-MM-dd HH:mm:ss" :picker-options="pickerBeginDateBefore" @change="changeTime">
</el-date-picker>
<el-date-picker v-model="formItem.planEndTime" type="datetime" placeholder="选择日期" size="small" value-format="yyyy-MM-dd HH:mm:ss" :pickeroptions="pickerBeginDateAfter">
</el-date-picker>
</div>
</template>
data() {
return {
filters: {
column: {
create_start_date: '',
create_end_date: ''
},
},
pickerBeginDateBefore: {
disabledDate: (time) => {
let beginDateVal = this.formItem.planEndTime;
if (beginDateVal) {
return time.getTime() > beginDateVal;
}
}
},
pickerBeginDateAfter: {
disabledDate: (time) => {
let beginDateVal =this.formItem.palnStartTime;
if (beginDateVal) {
return time.getTime() < beginDateVal;
}
}
}
}
}
//选择开始时间,清空结束时间
changeTime(date){
this.formItem.planEndTime="";
this.pickerBeginDateAfter={
disabledDate(time) { //开始时间-结束时间
return (time.getTime() < new Date(date).getTime());
}
}
},
GitHub 加速计划 / eleme / element
10
1
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:4 个月前 )
c345bb45
8 个月前
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 8 个月前
更多推荐
已为社区贡献6条内容
所有评论(0)