<el-date-picker v-model="time" popper-class='timeColor' type="month"
:picker-options="pickerOptions" value-format="yyyy-MM" placeholder="选择月">
</el-date-picker>
data中:
pickerOptions: {
disabledDate: (time) => {
let min = '2021-01'
let now = this.timeCopy
min = moment(min).unix()
let max = moment(now).unix()
time = time.getTime() / 1000
return time < min || time > max
}
},
script中需引入 moment.js 插件
import moment from 'moment'
style:
<style scoped lang="scss">
.timeColor {
.el-month-table td.today .cell {
color: #008f8f !important;
}
.el-month-table td .cell:hover {
color: #008f8f !important;
}
}
</style>
实现效果: