<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  <link href="https://cdn.staticfile.org/quill/1.3.6/quill.snow.css" rel="stylesheet">
</head>

<body>
  <div id="app">
    <el-date-picker v-model="startTime" size="small" type="date" placeholder="开始时间"
      :picker-options="pickerOptionsStart">
    </el-date-picker>
    <el-date-picker size="small" v-model="endTime" type="date" placeholder="结束时间" :picker-options="pickerOptionsEnd">
  </div>
</body>
<script src="https://cdn.staticfile.org/quill/1.3.6/quill.js"></script>
<!-- <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
  new Vue({
    el: '#app',
    data() {
      return {
        startTime: '',
        endTime: '',
        // 开始结束日期限制
        pickerOptionsStart: {
          disabledDate: (time) => {
            if (this.endTime) {
              return (
                time.getTime() >= new Date(this.endTime).getTime()
              );
            }
          }
        },
        // 结束日期限制
        pickerOptionsEnd: {
          disabledDate: (time) => {
            if (this.startTime) {
              return (
                time.getTime() <= new Date(this.startTime).getTime()
              );
            }
          }
        }
      }
    },
    methods: {
    }
  })
</script>

</html>
<script>
</script>
<style>

</style>

GitHub 加速计划 / eleme / element
54.06 K
14.63 K
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:2 个月前 )
c345bb45 6 个月前
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

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

更多推荐