# vue element-ui日期选择器限制90天范围
<el-form-item label="开票时间">
<el-date-picker
v-model="listQuery.test"
type="daterange"
:picker-options="pickerOptions"
size="small"
class="date-item"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
> pickerOptions绑定js
pickerOptions: {
onPick: ({ maxDate, minDate }) => {
this.choiceDate = minDate.getTime()
if (maxDate) {
this.choiceDate = ''
}
},
disabledDate: (time) => {
if ((this.choiceDate) !== '') {
const one = 90 * 24 * 3600 * 1000
const minTime = this.choiceDate - one
const maxTime = this.choiceDate + one
return time.getTime() < minTime || time.getTime() > maxTime
}
}
},
标签:vue,const,getTime,choiceDate,90,element,选择器
From: https://www.cnblogs.com/cloudfun/p/16965563.html