王士厅

电子报优化骨架屏逻辑

... ... @@ -51,6 +51,7 @@ export struct ENewspaperItemComponent {
.zIndex(10)
newsSkeleton()
.visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None)
.width('100%')
.zIndex(1)
if (this.contentWidth !== 0) {
Canvas(this.context)
... ... @@ -63,12 +64,13 @@ export struct ENewspaperItemComponent {
.zIndex(15)
}
}
.padding({
// this.itemPicWidth this.itemPicHeight 外层计算已减去,注掉解决骨架屏压缩变形
/*.padding({
top: 14,
right: 10,
bottom: 14,
left: 10
})
})*/
.backgroundColor(Color.White)
.width('100%')
.onTouch((event: TouchEvent) => {
... ...
... ... @@ -260,6 +260,7 @@ export struct ENewspaperPageComponent {
.width('100%')
.height(px2vp(this.picHeight) + 32)
.margin({ top: 59, left: 10, right: 10 })
.padding({ right: 10, left: 10 })
}
if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
... ... @@ -447,7 +448,7 @@ export struct ENewspaperPageComponent {
private async getNewspaperList() {
// ENewspaperItemComponent .padding({ top:14, right: 10, bottom: 14, left: 10 })
// 计算图片的内容宽高
let ratio = this.ratio == '100%' ? 1 : 0.6
let ratio = this.ratio == '100%' ? 1 : 0.5
this.itemPicWidth = this.picWidth * ratio - vp2px(20)
this.itemPicHeight = this.picHeight - vp2px(28)
try {
... ...
... ... @@ -14,26 +14,30 @@ export struct newsSkeleton {
Column() {
Row() {
Column() {
Image($r('app.media.peopleSeleton')).width('100%').height(47)// 后缀名不能省略
Image($r('app.media.peopleSeleton'))
.width(120.89)
.height(46.98)// 后缀名不能省略
.interpolation(ImageInterpolation.High)
textArea('100%', 8)
}
.width(124)
.margin({
right: 5
})
.width(120.89)
.alignItems(HorizontalAlign.Start)
.margin({ right: 5 })
Column() {
Row()
.width(27)
.width(`16.5%`)
.height(25)
.backgroundColor('#FFF5F5F5')
Row()
.width(27)
.width(`16.5%`)
.height(4)
.backgroundColor('#FFF5F5F5')
.margin({ top: 3, bottom: 3 })
Row()
.width(27)
.width(`16.5%`)
.height(20)
.backgroundColor('#FFF5F5F5')
// textArea(27, 25)
... ... @@ -113,7 +117,6 @@ export struct newsSkeleton {
Column().backgroundColor('#909090').height(5).width(326)
}
.width('100%')
.padding({ right: 10, left: 10 })
}
.height('100%')
... ...