2024年06月23日 建站教程
//默认根据月份显示当前月的第一天和最后一天 <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() }
本文链接:http://so.lmcjl.com/news/7134/