Does DatePicker select a specified date in element?

problem description

when using the DatePicker component in element, I want to limit the optional dates to an array where dates are selectable and other dates are disabled

the environmental background of the problems and what methods you have tried

tried to use disabledDate in picker-options, but reported an error

related codes

/ / Please paste the code text below (do not replace the code with pictures)

// avaiableDateList["2019-02-01","2019-02-02",...]
disabledDate: (time) => {
     let date = moment(time.getTime()).format("YYYY-MM-DD")
     return this.avaiableDateList.indexOf(date) === -1;
}

what result do you expect? What is the error message actually seen?

Jun.30,2022

I was wrong before

<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/element-ui@2.5.4/lib/index.js"></script>
<div id="app">
<template>
  <div class="block">
    <span class="demonstration"></span>
    <el-date-picker v-model="value1" type="date" placeholder="" :picker-options="pickerOptions">
    </el-date-picker>
  </div>
</template>
</div>
var Main = {
    data() {
      return {
        avaiableDateList:['2019-02-01','2019-02-02','2019-02-04','2019-02-05','2019-02-08'],
        pickerOptions: {
          disabledDate:(time)=>{
            var date = time.Format("yyyy-MM-dd");
                     return !this.avaiableDateList.includes(date);
          }
        },
        value1: ''
      };
    }
  };
var Ctor = Vue.extend(Main)
new Ctor().$mount('-sharpapp')

Date.prototype.Format = function (fmt) { //author: meizz
    var o = {
        "M+": this.getMonth() + 1, //
        "d+": this.getDate(), //
        "h+": this.getHours(), //
        "m+": this.getMinutes(), //
        "s+": this.getSeconds(), //
        "q+": Math.floor((this.getMonth() + 3) / 3), //
        "S": this.getMilliseconds() //
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}
//var time1 = new Date().Format("yyyy-MM-dd");var time2 = new Date().Format("yyyy-MM-dd HH:mm:ss");

clipboard.png


 pickerDate:{
                    disabledDate: (time) => {
                        let beginDate =new Date('2018-01-02')
                        let    endDate =new Date('2019-01-02')
                        return time.getTime() > endDate.getTime() || time.getTime() <beginDate.getTime()
                    }
                }

try this

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea25b3-1bd1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea25b3-1bd1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?