element-ui日期时间选择框picker-options如

2022-08-30  本文已影响0人  Annun
<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="选择日期"
/>
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());
            }
        }
    }
}
上一篇下一篇

猜你喜欢

热点阅读