!3738 【Sample】修复chat朋友圈九宫格图片较少存在空白的问题

Merge pull request !3738 from 王田盛/master
This commit is contained in:
openharmony_ci 2023-11-22 08:03:54 +00:00 committed by Gitee
commit b9a6948923
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -31,6 +31,7 @@ const MAKE_LOCAL_DATA_TRACE_ID: number = 2; // makeDataLocal 中使用的 taskId
const LAYOUT_WEIGHT: number = 1; // 自动分配剩余空间
const LIST_SPACE: number = 8; // 列表默认间隔
const PROMPT_DURATION: number = 3500; // 提示框持续时间
const GRID_COLUMN_NUMBER: number = 3; // 九宫格每行图片数
@Entry
@Component
@ -126,7 +127,7 @@ struct FriendsMomentsPage {
let message = (error as BusinessError).message;
let code = (error as BusinessError).code;
Logger.info(`showToast args error code is ${code}, message is ${message}`);
};
}
}
hiTraceMeter.finishTrace(MAKE_LOCAL_DATA_TRACE, MAKE_LOCAL_DATA_TRACE_ID);
}
@ -177,9 +178,9 @@ struct OneMoment {
Column() {
if (this.moment.imageList.length) {
if (this.moment.imageList.length >= this.imageListMinLength) {
Grid() {
GridRow({ columns: GRID_COLUMN_NUMBER, gutter: $r('app.integer.friendMomentsPage_grid_gap') }) {
ForEach(this.moment.imageList, (image: string, index?: number) => {
GridItem() {
GridCol() {
Image(image)
.id(`${index}`)
.width($r('app.integer.friendMomentsPage_image_width'))
@ -199,11 +200,6 @@ struct OneMoment {
}
}, (image: string) => image)
}
.columnsTemplate('1fr 1fr 1fr')
.rowsTemplate('1fr 1fr 1fr')
.columnsGap($r('app.integer.friendMomentsPage_grid_gap'))
.rowsGap($r('app.integer.friendMomentsPage_grid_gap'))
.height($r('app.integer.friendMomentsPage_grid_width'))
.width($r('app.integer.friendMomentsPage_grid_height'))
}
else {