<template>
<div>
<h2>Welcome</h2>
<el-card>
<div class="block">
<span class="demonstration">月</span>
<el-date-picker v-model="date" type="month" placeholder="选择日期" :picker-options="pickerOptions0"></el-date-picker>
</div>
</el-card>
</div>
</template>
<script>
export default {
components: {},
data() {
return {
date: '',
pickerOptions0: {
disabledDate(time) {
//三个月到现在的日期
//let curDate = new Date().getTime();
//let three = 90 * 24 * 3600 * 1000;
//let threeMonths = curDate - three;
//return time.getTime() + 24 * 3600 * 1000 > Date.now() || time.getTime() < threeMonths;
//设置选择今天以及今天之后的日期
// return time.getTime() < Date.now() - 8.64e7;
//设置选择今天以及今天以前的日期
//return time.getTime() > Date.now() - 8.64e6
//设置选择今天之后的日期(不能选择当天时间)
//return time.getTime() < Date.now();
//设置选择今天之前的日期(不能选择当天)
//return time.getTime() > Date.now();
//2021年-1月到现在的日期
let threeMonths = new Date('2021-01').getTime();
return time.getTime() + 24 * 3600 * 1000 > Date.now() || time.getTime() < threeMonths;
},
},
};
},
created() {},
methods: {},
};
</script>
<style scoped></style>