LabelComponent.ets
1.26 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
import { CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { CompUtils } from '../../utils/CompUtils';
const TAG = 'LabelComponent';
/**
* 标题/标签组件(暂时仅展示主标题,不展示子标题)
* Label-03
* 重磅推荐/精选/电视剧/电影/综艺/短剧/更多>/
*/
@Component
export struct LabelComponent {
@State compDTO: CompDTO = {} as CompDTO
@State compIndex: number = 0;
build() {
Row() {
Text(CompUtils.getLabelTitle(this.compDTO.extraData))
.width(CommonConstants.FULL_PARENT)
.padding({
left: $r('app.float.main_margin'),
right: $r('app.float.main_margin'),
top: $r('app.float.label_margin_top'),
bottom: $r('app.float.label_margin_bottom')
})
.fontSize($r('app.float.normal_text_size'))
.fontWeight(FontWeight.Bold)
.maxLines(1)// .backgroundColor(Color.Yellow)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
}
.borderRadius({
topLeft:this.compIndex === 0 ? $r('app.float.image_border_radius'):0,
topRight:this.compIndex === 0 ? $r('app.float.image_border_radius'):0
})
.width(CommonConstants.FULL_PARENT)
.justifyContent(FlexAlign.Start)
}
}