获取年月YYYY-MM
文章目录
setDefaultValues() {
return new Promise(resolve => {
const year = moment().year()
// moment月份范围是 0~11, 默认设置为上个月, 不需要 -1
let month = moment().month()
if (month === 0) {
month = 12
}
this.defaultMonth = moment(`${year}-${month}`, 'YYYY-MM')
this.queryParam.lineId = 41
this.queryParam.date = this.defaultMonth.format('YYYY-MM')
resolve()
})
},
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论