const startDate = ref(new Date())
vue中使用new Date获取当前时间,得到原生格式:
解决方法:
//在终端安装:
npm install dayjs
// 日期范围的处理
const nowDate = new Date()
const startDate = ref(formatMonthDay(nowDate))
const newDate = nowDate.setDate(nowDate.getDate() + 1) //不能直接+1,月份日期不固定
const endDate = ref(formatMonthDay(newDate))
完美解决!