LabelComponent.ets
1.06 KB
import { CompDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant';
import { CompUtils } from '../utils/CompUtils';
const TAG = 'LabelComponent';
/**
* 标题/标签组件(暂时仅展示主标题,不展示子标题)
* Label-03
* 重磅推荐/精选/电视剧/电影/综艺/短剧/更多>/
*/
@Entry
@Component
export struct LabelComponent {
@State compDTO: CompDTO = {} as CompDTO
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 }) // 超出的部分显示省略号。
}
.width(CommonConstants.FULL_PARENT)
.justifyContent(FlexAlign.Start)
}
}