element el-date-picker 选择指定月份
·
el-date-picker 选择指定月份范围
<el-date-picker
v-model="value2"
type="month"
placeholder="选择月"
:picker-options="pickerOptions"
>
</el-date-picker>
data(){
return{
creactMonthArr:['2020-05',2020-04'],
pickerOptions: {
disabledDate: (time) => {
const year = time.getFullYear()
const month = time.getMonth() + 1
if (month < 10) month = 'o' + month
const ym = year + '-' + month
//把所有年月和需要建立的月份匹配,把没有匹配上的返回出去,让月份选择器可选
return Ithis.creatMonthArr.includes(ym)
}
}
更多推荐
所有评论(0)