element-ui日期选择器限制选择范围
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
免费下载资源
·
- 只能选当日或之前的日期
//页面中的
<el-date-picker type="date" value-format="timestamp" v-model="form.birthDate" placeholder="选择日期" class="display-block" :picker-options="pickerBeginDateBefore"></el-date-picker>
//放在data中的
pickerBeginDateBefore: {
disabledDate: time => {
let _now = Date.now();
return time.getTime() > _now;
}
},
- 选时间段之间的范围
<el-form-item label="入住日期" class="inline">
<el-date-picker value-format="timestamp" v-model="params.startDate" type="date" :picker-options="pickerBeginDateBefore" placeholder="选择日期">
</el-date-picker>
<span class="item-font">至</span>
<el-date-picker value-format="timestamp" v-model="params.endDate" type="date" :picker-options="pickerBeginDateAfter" placeholder="选择日期">
</el-date-picker>
</el-form-item>
//data中的
pickerBeginDateBefore: {
disabledDate: time => {
let beginDateVal = this.params.endDate;
if (beginDateVal) {
return time.getTime() > beginDateVal;
}
}
},
pickerBeginDateAfter: {
disabledDate: time => {
let beginDateVal = this.params.startDate;
if (beginDateVal) {
return time.getTime() < beginDateVal;
}
}
},
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 个月前
更多推荐
已为社区贡献10条内容
所有评论(0)