提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 需求一、实现二、效果 需求 计算当月剩余天数 一、实现 var curDate = new Date(); var curMonth = curDate.getMonth(); //当前月份 需要加1 curDate.setMonth(curMonth + 1); curDate.setDate(0) //关键 curDate.getDate(); //计算的当月总天数 curDate.getDate()-new Date().getDate() // new Date().getDate()当前几号 总天数-当前即可 二、效果