yangchenggong1_wd

desc:评论UI 调整

... ... @@ -44,7 +44,8 @@ export struct CommentText {
textContent: this.longMessage,
fontSize: this.fontSize,
fontWeight: this.fontWeight,
constraintWidth: (this.screenWidth - padding)
constraintWidth: (this.screenWidth - padding),
wordBreak:WordBreak.BREAK_ALL
})
console.log(`文本宽度为:${this.textWidth}`)
... ... @@ -71,7 +72,8 @@ export struct CommentText {
textContent: string,
fontSize: this.fontSize,
fontWeight: this.fontWeight,
constraintWidth: (this.screenWidth - padding)
constraintWidth: (this.screenWidth - padding),
wordBreak:WordBreak.BREAK_ALL
})
//计算有误差20
... ... @@ -130,6 +132,7 @@ export struct CommentText {
.fontWeight(this.fontWeight)
.fontColor(this.fontColor)
.maxLines(this.lines)
.wordBreak(WordBreak.BREAK_ALL)
// .backgroundColor(Color.Red)
... ...
... ... @@ -15,6 +15,7 @@ export struct ChildCommentComponent {
@State isExpandParent: boolean = false;
@State isOverLines: boolean = false
@State isOverLinesParent: boolean = false
testText:string = "1,因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸"
build() {
Column() {
... ... @@ -71,7 +72,7 @@ export struct ChildCommentComponent {
})
}
}
.margin({ bottom: '10lpx' })
.margin({ bottom: '5lpx' })
.width('100%')
.height('108lpx')
.padding({ left: '31lpx', right: '31lpx' })
... ... @@ -93,6 +94,7 @@ export struct ChildCommentComponent {
})
}
}.maxLines(5)
.wordBreak(WordBreak.BREAK_ALL)
.textStyle()
}
}.padding({ left: '31lpx', right: '31lpx' })
... ... @@ -138,6 +140,7 @@ export struct ChildCommentComponent {
})
}
}.maxLines(5)
.wordBreak(WordBreak.BREAK_ALL)
.textAlign(TextAlign.Start)
.width('100%')
}
... ... @@ -243,11 +246,13 @@ export struct ChildCommentComponent {
let measureTruncateWidth: number = measure.measureText({
textContent: truncateContent,
fontSize: px2fp(fontSize),
wordBreak:WordBreak.BREAK_ALL
})
if(type === 1){
measureTruncateWidth = measureTruncateWidth + measure.measureText({
textContent: `@${this.data.parentCommentUserName}:`,
fontSize: px2fp(fontSize),
wordBreak:WordBreak.BREAK_ALL
})
}
let clipStr: string = ''
... ... @@ -255,6 +260,7 @@ export struct ChildCommentComponent {
if (measure.measureText({
textContent: clipStr,
fontSize: px2fp(fontSize),
wordBreak:WordBreak.BREAK_ALL
}) >= textWidth * maxLines - measureTruncateWidth) {
if (type === 0) {
this.isOverLines = true
... ...