guochunsong

修改13单片卡ui适配

... ... @@ -19,7 +19,8 @@ export struct SingleImageCardComponent {
@State titleNumber: number = 3 //标题行数
aboutToAppear() {
if(this.compDTO.operDataList[0].newsTitle.length > 25){
Logger.debug(TAG + "" + JSON.stringify(this.compDTO.operDataList));
if(this.compDTO.operDataList[0].newsTitle.length > 26){
this.titleNumber = 3;
} else {
this.titleNumber = 2;
... ... @@ -35,7 +36,7 @@ export struct SingleImageCardComponent {
.maxLines(this.titleNumber)//
.alignSelf(ItemAlign.Start)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.height("70%")
.height(this.titleNumber === 3 ?"80%" : '65%')
Row() {
Text('人民日报')
.height(40)
... ... @@ -56,20 +57,22 @@ export struct SingleImageCardComponent {
left: 10
})
}.alignSelf(ItemAlign.Start)
.height("30%")
.height(this.titleNumber === 3 ? "20%" : '35%')
.justifyContent(FlexAlign.SpaceBetween)
}
.alignItems(HorizontalAlign.Start)
.justifyContent(FlexAlign.SpaceBetween)
.width('58%')
Blank(16)
Image(this.compDTO.operDataList[0].coverUrl)
.width('38%')
.height('78vp')
.borderRadius(5)
.aspectRatio(3 / 2)
}
.padding(
{ top: 16, bottom: 16, left: 14, right: 14 })
.width(FULL_PARENT)
.height(this.titleNumber === 3 ? '152vp' : '106vp')
.height(this.titleNumber === 3 ? '127vp' : '106vp')
.justifyContent(FlexAlign.SpaceBetween)
}
}
\ No newline at end of file
... ...
... ... @@ -30,11 +30,12 @@ export struct ZhGridLayoutComponent {
Column() {
Image(item.coverUrl)
.width(50)
.borderRadius(5)
.aspectRatio(1 / 1)
.autoResize(true)
Text(item.newsTitle)
.fontSize(16)
.margin({ top: 10 })
.padding({ top: 10 })
}.margin({
top:5,
bottom:5,
... ...