el-date-picker时间插件,根据月份显示当前月的第一 发布时间:2024/12/08 //默认根据月份显示当前月的第一天和最后一天 <el-date-picker v-model="geMonth" type="month" placeholder="请选择账期" format="yyyy-MM" value-format="yyyy-MM" @change="getMyDateTime()" ></el-date-picker> getMyDateTime() { const now = new Date(this.geMonth); const nowMonth = now.getMonth(); const nowYear = now.getFullYear(); const monthStartDate = new Date(nowYear, nowMonth, 1); const monthEndDate = new Date(nowYear, nowMonth + 1, 0); this.startTime2 = monthStartDate.getFullYear() + '-' + (monthStartDate.getMonth() + 1) + '-' + monthStartDate.getDate() this.endTime2 = monthEndDate.getFullYear() + '-' + (monthEndDate.getMonth() + 1) + '-' + monthEndDate.getDate() } 复制代码 以上是编程学习网小编为您介绍的“el-date-picker时间插件,根据月份显示当前月的第一”的全面内容,想了解更多关于 vuejs 内容,请继续关注编程基础学习网。