HTML
<div id="news">
<div class="block">
<el-date-picker
size="mini"
v-model="startenddate"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:picker-options="pickerOptions0"
:editable="false"
:clearable="true"
>
</el-date-picker>
</div>
</div>
<script src="js/vue.js"></script>
<script src="./js/element-ui/index.js" type="text/javascript" charset="utf-8"></script>
<script src="./js/time.js"></script>
time.js
new Vue({
el: '#news',
data() {
return {
dialogVisible: true,
time:'123',
startDate:'',
startenddate:'',
startdate:'2021-06-01',
enddate:'2021-06-30',
pickerOptions0:this.limitDate(),
}
},
methods: {
limitDate(){
let self = this;
return {
disabledDate(time){
return time.getTime() < new Date(self.startdate).getTime() - 24*60*60*1000 || time.getTime() > new Date(self.enddate).getTime();
}
}
},
}
})
效果图
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/21fa9ab2fa09b5b5f68be7533ba27cf4.png)