// 获取当月第一天数据 getCurrentMonthFirst() { let date = new Date() date.setDate(1) let month = parseInt(date.getMonth() + 1) let day = date.getDate() if (month < 10) month = '0' + month if (day < 10) day = '0' + day return date.getFullYear() + '-' + month + '-' + day }
// 获取当月最后一天数据 getCurrentMonthLast() { let date = new Date() let year = date.getFullYear() let month = date.getMonth() + 1 month = month < 10 ? '0' + month : month let day = new Date(year, month, 0) return year + '-' + month + '-' + day.getDate() }标签:vue,第一天,month,Date,日期,let,year,date,day From: https://www.cnblogs.com/xufeng-moxuan/p/17600384.html