const getDate = ref('')
// 计算当月天数
function getCountDays() {
var curDate = new Date();
// 获取当前月份
var curMonth = curDate.getMonth();
// 实际月份比curMonth大1,下面将月份设置为下一个月
curDate.setMonth(curMonth + 1);
// 将日期设置为0,表示自动计算为上个月(这里指的是当前月份)的最后一天
curDate.setDate(0);
// 返回当前月份的天数
getDate.value = curDate.getDate();
}
计算当月天数
于 2023-12-12 10:07:54 首次发布