diff --git a/src/views/cai/anchorImCountDay/index.vue b/src/views/cai/anchorImCountDay/index.vue index f3fdfd8..f9eec41 100644 --- a/src/views/cai/anchorImCountDay/index.vue +++ b/src/views/cai/anchorImCountDay/index.vue @@ -126,7 +126,7 @@ export default { pageSize: 10, mobile: undefined, usercode: undefined, - countDate: new Date(), + countDate: this.getYesterdayFormatted(), }, }; }, @@ -134,6 +134,17 @@ export default { this.getList(); }, methods: { + getYesterdayFormatted() { + const yesterday = new Date(); + yesterday.setDate(yesterday.getDate() - 1); // 日期减1天 + + const year = yesterday.getFullYear(); + // 月份和日期需要补零处理 + const month = String(yesterday.getMonth() + 1).padStart(2, '0'); + const day = String(yesterday.getDate()).padStart(2, '0'); + + return `${year}-${month}-${day}`; + }, /** 查询每日发言统计列表 */ getList() { this.loading = true;