• Ajax
  • Ant design
  • Axios-Fetch
  • Avue
  • Browser
  • Canvas
  • CSS
  • Dos-bat
  • Dva
  • Dedecms
  • Echart
  • ElementUI
  • Editors
  • Git
  • GeoServer
  • GIS
  • H5
  • Jquery
  • Java安卓
  • Json
  • Javascript
  • Leaflet
  • Linux
  • Life-Info
  • Mock
  • MongoDB
  • Network
  • NodeJS
  • NPM
  • React
  • 设计运营
  • SEO
  • SVG
  • TypeScript
  • Tools
  • umi
  • uni-APP
  • Vant
  • Vue
  • Windows
  • webpack
  • 位置:OC中文网 > 其他 > ElementUI >

    el-date-picker指定日期禁用

    来源:openlayers-cesium.com 时间:07-27

    在使用el-date-picker的时候,有的情况下需要禁用某个时间段的时间。

    HTML

    1. <el-date-picker size="mini" v-model="time" type="daterange" :range-separator="$t('common.to')" 
    2.     :start-placeholder="$t('common.stime')" :end-placeholder="$t('common.etime')" 
    3.     style="width: 300px;" value-format="yyyy-MM-dd" :picker-options="pickerOptions"> 
    4. </el-date-picker> 

    示例一:

    data中:

    1. pickerOptions:
    2.      disabledDate(time) { 
    3.        return time.getTime() > Date.now()-24*60*60*1000 
    4.      } 
    5.  
    6. }, 

    示例二:

    data中:
     
    1. pickerOptions:{ 
    2.      disabledDate(time) { 
    3.         return time.getTime() < Date.now() 
    4.     } 
    5. },