ZhGridLayoutComponent.ets
1.31 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { Action, CompDTO, ContentDTO, Params } from 'wdBean';
import { CompStyle } from 'wdConstant';
import { Logger } from 'wdKit';
import { WDRouterRule } from 'wdRouter';
const TAG = 'Zh_Grid_Layout-03';
const FULL_PARENT: string = '100%';
/**
* 金刚卡位
* 枚举值Zh_Grid_Layout-03
* Zh_Grid_Layout-03
*
*/
@Entry
@Component
export struct ZhGridLayoutComponent {
@State compDTO: CompDTO = {} as CompDTO
aboutToAppear() {
Logger.info(TAG + ' comp:'+ JSON.stringify(this.compDTO))
}
build() {
Column() {
Flex({ wrap: FlexWrap.Wrap,
justifyContent: FlexAlign.SpaceEvenly,
alignItems :ItemAlign.End}) {
ForEach(this.compDTO.operDataList, (item: ContentDTO) => {
Column() {
Image(item.coverUrl)
.width(50)
.aspectRatio(1 / 1)
.autoResize(true)
Text(item.newsTitle)
.fontSize(16)
.margin({ top: 10 })
}.margin({
top:5,
bottom:5,
left:5,
right :5
})
}, (item: ContentDTO) => JSON.stringify(item))
}
.backgroundColor(Color.White)
.borderRadius(12)
.padding({
top: 10,
bottom: 10
})
.width(FULL_PARENT)
.margin(10)
}
}
}