LabelComp.ets
1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* 主界面更多,按钮Comp
*/
import { CompDTO } from '../bean/CompDTO';
import { LabelBean } from '../bean/LabelBean';
import { NetDataStatusType } from '../enum/NetDataStatusType';
import { DataFromExtraComp } from './DataFromExtraComp';
import List from '@ohos.util.List';
import { LabelDTO } from '../bean/LabelDTO';
import { ExtraDTO } from '../bean/ExtraDTO';
import { WDGroup } from './WDGroup';
export class LabelComp extends DataFromExtraComp<LabelBean> {
constructor(parent: WDGroup, compDTO: CompDTO, initParams: Map<string, Object>) {
super(parent, compDTO, initParams);
this.status = NetDataStatusType.LOADED
}
public getItems(): List<LabelBean> {
return this.items;
}
protected convertDto2Vo(extraDataDTO: ExtraDTO): List<LabelBean> {
if (!extraDataDTO) {
return new List<LabelBean>();
}
let beanList: List<LabelBean> = new List<LabelBean>();
// let dtoArray: LabelDTO[] | undefined = extraDataDTO["labels"]
let dtoArray: LabelDTO[] | undefined= extraDataDTO.labels
if (!dtoArray) {
return new List<LabelBean>();
}
for (let index = 0; index < dtoArray.length; index = index + 1) {
let dto: LabelDTO = dtoArray[index];
let bean: LabelBean = new LabelBean(dto);
beanList.add(bean);
}
return beanList;
}
}