• 只能选当日或之前的日期
//页面中的
<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 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐