el-time-picker 自定义选择时间范围
时间:2021-09-03 22:40:07
收藏:0
阅读:22
<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} `] //设置只可选择此刻之前的时间,此刻之后的时间禁选
})(),
}
}
}
原文:https://www.cnblogs.com/dqpz/p/15223180.html
评论(0)