我有Project的接口,进入这个变量状态声明为数字。但是,当状态发生变化时,如何为每次更改添加日期。
这是界面
export interface Project {
state: number;
}
这是我编辑项目的时候
<div fxLayout="column" fxLayoutAlign="start start" fxLayoutGap="15px">
<app-dropdown [(ngModel)]="editProject.state" label="Project State" labelWidth="100px" optionWidth="250px" orientation="top"
[items]="projectState" (click)="changeStatesAndTypes()"></app-dropdown>
</div>
这是changeStateAndTypes方法。
changeStatesAndTypes() {
if (this.editProject.type === 2) {
this.projectState = [{key: 0, value: 'Published'}];
this.editProject.state = 0;
} if (this.editProject.state === 0) {
this.projectType =
[{key: 0, value: 'Approved'},
{key: 1, value: 'Denied'},
{key: 2, value: 'Waiting for Approval'},
{key: 4, value: 'ReDo'}];
} if (this.editProject.type === 0) {
this.projectState = [{key: 2, value: 'In progress'}];
this.editProject.state = 2;
}
}