Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
yangchenggong1_wd
2024-04-25 11:18:24 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6e7217edf4e9226453cbabc098acdff3f798160f
6e7217ed
1 parent
55d49f37
desc:评论UI 调整
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentText.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/ChildCommentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentText.ets
View file @
6e7217e
...
...
@@ -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)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/ChildCommentComponent.ets
View file @
6e7217e
...
...
@@ -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: '
10
lpx' })
.margin({ bottom: '
5
lpx' })
.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
...
...
Please
register
or
login
to post a comment