02-日期组件 禁止时间选择,限制到时分秒

<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) {
            var date=new Date();
             date.setFullYear(date.getFullYear()+2);
             date.setDate(date.getDate()-1);
                 return (time.getTime() < Date.now() - 8.64e7)||(time.getTime()>date.getTime());
          }
      }
   }
}

 

posted @ 2021-10-29 15:13  猎奇游渔  阅读(539)  评论(0编辑  收藏  举报