el-date-picker月选择器获取选择的日期范围
el-date-picker月选择器获取选择的日期范围


<el-date-picker
v-model="monthValue"
type="month"
placeholder="选择月"
value-format="yyyy-MM-dd"
@change="monthChange"
>
</el-date-picker>
monthChange(val) {
const [year, month, day] = val.split('-') // 获取对应的年月日
const endDate = new Date(year, month, 0).getDate() // 获取对应的年所在月有多少天
let res = [`${year}-${month}-${day}`, `${year}-${month}-${endDate}`]
console.log(res)
},
本文来自博客园,作者:毛三仙,转载请注明原文链接:https://www.cnblogs.com/ProgrammerMao-001/p/18342762

浙公网安备 33010602011771号