js常用方法-获取当前月天数数组
方法
/** * 应用于图表插件---获取当前月天数数组 * @param * @returns {obj} */ static getChartMonth() { let dataTimes = []; let date = new Date(); let year = date.getFullYear(); let month = date.getMonth() + 1; let d = new Date(year, month, 0); let n = +d.getDate(); for (var i = 1; i < n + 1; i++) { dataTimes.push(i + ' 号'); } return dataTimes; //返回天数数组 }
使用
console.log('当前月数组---', this.myUtils.getChartMonth())


浙公网安备 33010602011771号