1、枚舉數據定義對象
export enum enumType { // @ts-ignore type1={value:1,text:'文字1'}, // @ts-ignore type2={value:2,text:'文字2'} };
定義了枚舉類型后使用遍歷成數據集
2、枚舉類型遍歷取值
//引入枚舉 enumType:any=enumType;//類型枚舉 typelist:any[]=[] //枚舉數據集 //在create方法 調用 for(var key in this.enumType) { var temp = this.enumType[key]; if(temp.toString().indexOf('type')>-1){}else{ this.typelist.push(this.enumType[key]) } }