|
|
@@ -1,4 +1,4 @@
|
|
|
-import { Component, OnInit } from '@angular/core';
|
|
|
+import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
|
|
|
import { CommonModule, DatePipe } from '@angular/common';
|
|
|
import { HttpClient } from '@angular/common/http';
|
|
|
import { Router } from '@angular/router';
|
|
|
@@ -203,7 +203,8 @@ export class MessageDashboardComponent implements OnInit {
|
|
|
constructor(
|
|
|
private http: HttpClient,
|
|
|
private message: NzMessageService,
|
|
|
- private router: Router
|
|
|
+ private router: Router,
|
|
|
+ private cd: ChangeDetectorRef // 注入 ChangeDetectorRef
|
|
|
) {
|
|
|
Chart.register(...registerables);
|
|
|
}
|
|
|
@@ -266,7 +267,13 @@ export class MessageDashboardComponent implements OnInit {
|
|
|
})
|
|
|
),
|
|
|
})
|
|
|
- .pipe(finalize(() => (this.isLoading = false)))
|
|
|
+ .pipe(
|
|
|
+ finalize(() => {
|
|
|
+ this.isLoading = false;
|
|
|
+ // 在所有数据都赋值完毕后,手动触发变更检测
|
|
|
+ this.cd.detectChanges();
|
|
|
+ })
|
|
|
+ )
|
|
|
.subscribe((results: any) => {
|
|
|
// Assign data to component properties
|
|
|
this.overallStats = results.overall;
|