配餐项目前端文件
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

33 lines
767 B

import { Component } from "@angular/core";
import { ApiService } from "@cdk/services";
import { format } from "date-fns";
import { Subject, interval, takeUntil } from "rxjs";
@Component({
selector: "app-data-vis",
templateUrl: "./data-vis.component.html",
styleUrls: ["./data-vis.component.less"],
})
export class DataVisComponent {
constructor(private api: ApiService) {}
destroy$ = new Subject();
showTime: string = "";
ngOnInit(): void {
interval(1000)
.pipe(takeUntil(this.destroy$))
.subscribe(() => {
this.showTime = format(new Date(), "yyyy-MM-dd HH:mm:ss");
});
this.api.getMenuDataVis().subscribe((res) => {
console.log("res", res);
});
}
ngOnDestroy(): void {
this.destroy$.next(null);
this.destroy$.complete();
}
}