<template> <el-date-picker style="width:260px;" V-model="timeRange" type="daterange" range-separator=" value-format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickeroptions" ></el-date-picker> </template>
<script> data() { return { selectDate: '', //日期选择范围在一个月内 pickerOptions: { onPick: ({ maxDate, minDate }) => { this.selectDate = minDate.getTime() if (maxDate) { this.selectDate = '' } }, disabledDate: (time) => { if (this.selectDate !== '') { const one = 30 * 24 * 3600 * 1000 const minTime = this.selectDate - one const maxTime = this.selectDate + one return time.getTime() < minTime || time.getTime() > maxTime } } } } </script>
标签:控件,const,elementUI,getTime,maxDate,一个月,time,selectDate From: https://www.cnblogs.com/zeosky-zhe/p/18542031