import { Pipe, PipeTransform } from '@angular/core'; @Pipe({name: 'testState'}) export class testState implements PipeTransform { transform(name: string): string { if(name == "1"){ return "未开考" }else if(name == "2"){ return "开考中" }else{ return "已结束" } } } export enum PlanLevelEnum { "自定义预案", "总队", "支队", "编制级别3", "大队", "编制级别5", "编制级别6", "编制级别7", "中队" } @Pipe({name: 'planlevel'}) export class PlanLevel implements PipeTransform { transform(value: number): string { return PlanLevelEnum[value] } }