el-time-picker 自定义选择时间范围


<el-time-picker
          v-model="clostTime"
          :editable="false"
          :clearable='false'
          format="HH:mm"
          default-value=''
          :picker-options="pickerOptions2"
          placeholder="请选择关闭时间">
 </el-time-picker>
 
在data的pickerOptions2中设置时间的选择范围
 
data(){
  return{  
    pickerOptions2:{
            selectableRange:(()=>{
                let data=new Date();
                let hour=data.getHours();
                let minute=data.getMinutes();
                let second=data.getSeconds();
                return [`0:00:00 - ${hour}:${minute}:${second} `]    //设置只可选择此刻之前的时间,此刻之后的时间禁选
            })(),
        }
  }
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM