<el-date-picker
v-model="expireDate"
type="datetime"
@change="handle"
format='yyyy-MM-dd HH:mm:ss'
value-format='yyyy-MM-dd HH:mm:ss'
:picker-options="pickerOptions"
placeholder="选择日期"
/>
- 时间 selectableRange [
00:00:00 - 23:59:59
]
- 日期 disabledDate 前禁 || 后禁
data(){
return {
expireDate:'',
pickerOptions: {
selectableRange:(()=>{
let data=new Date();
let hour=data.getHours();
let minute=data.getMinutes();
let second=data.getSeconds();
return [`${hour}:${minute}:${second} - 23:59:59`]
})(),
disabledDate(time) {
const date=new Date();
date.setFullYear(date.getFullYear()+2);
date.setDate(date.getDate()-1);
return (time.getTime() < Date.now() - 8.64e7)||(time.getTime()>date.getTime());
}
}
}
}
网友评论