通过css样式控制不显示上一个月和下一个月的天数,并且不可点击
<el-calendar v-model="calendarValue">
<template
slot="dateCell"
slot-scope="{date, data}">
<p>
<template>
<span>{{ data.day.split('-').slice(2).join('-') }}</span>
</template>
</p>
</template>
</el-calendar>
css样式,这里使用的是scss
::v-deep .el-calendar-table:not(.is-range) td.prev,
::v-deep .el-calendar-table:not(.is-range) td.next {
cursor: not-allowed;
pointer-events: none;
}
.prev>.el-calendar-day>p{
display: none;
}
.next>.el-calendar-day>p{
display: none;
}
效果如下: