wangliang_wd

feat:优化动态详情页图片展示

... ... @@ -86,6 +86,9 @@ export struct DynamicDetailComponent {
@State isScrollTop: boolean = true
@State executedStartTime: number = new Date().getTime()
@State onePicW: number = 0; // 只有一张图时候图片的宽度
@State onePicH: number = 0; // 只有一张图时候图片的高度
pageParam: ParamType = {}
commentListAreaInfo?: Area
lastTimeoutId?: number
... ... @@ -361,17 +364,37 @@ export struct DynamicDetailComponent {
ProcessUtils.gotoMultiPictureListPage(this.contentDetailData.photoList, index)
})
} else {
// GridCol({
// span: { xs: 8 }
// }) {
// Image(item.picPath)
// .width('100%')
// .borderRadius(this.caclImageRadius(index))
// .autoResize(true)
// .opacity(!item.width && !item.height ? 0 : 1)
// .onComplete(callback => {
// item.width = callback?.width || 0;
// item.height = callback?.height || 0;
// })
// }
GridCol({
span: { xs: 8 }
span: this.onePicW > this.onePicH ? 12 : 8
}) {
Image(item.picPath)
.backgroundColor(0xf5f5f5)
.width('100%')
.borderRadius(this.caclImageRadius(index))
.autoResize(true)
.objectFit(ImageFit.Cover)
.autoResize(true)
.aspectRatio(3/4)
.borderRadius(this.caclImageRadius(index))
.borderStyle(BorderStyle.Solid)
.borderWidth(0.5)
.borderColor($r('app.color.color_0D000000'))
.opacity(!item.width && !item.height ? 0 : 1)
.onComplete(callback => {
item.width = callback?.width || 0;
item.height = callback?.height || 0;
.onComplete((event?) => {
this.onePicW = event?.width || 0;
this.onePicH = event?.height || 0;
})
}
.onClick(async (event: ClickEvent) => {
... ...