const arr = []
const date = ['2022-7-29', '2022-8-2']
let timeA = this.$djs(date[0] || this.$djs().subtract(2, 'day')).valueOf()
const timeB = this.$djs(date[1] || this.$djs()).valueOf()
do {
arr.push(this.$djs(timeA).format('YYYY-MM-DD'))
timeA = Number(timeA) + (24 * 3600 * 1000)
} while (timeA <= timeB)
console.log(arr)

网友评论