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
chenjun
2024-08-07 17:25:34 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
45e1c148b7723c509f429268b2955d18cb2179b0
45e1c148
1 parent
71a170a0
title和summary总行数为4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerTitleView.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerTitleView.ets
View file @
45e1c14
...
...
@@ -16,6 +16,11 @@ export struct PlayerTitleView {
@State rmhPlatform: number = 0 // 1是人民号
@State isOverLines: boolean = false
@State summary: string = ''
@State private titleLines: number = 0
@State private summaryLines: number = 0
dialogController: CustomDialogController = new CustomDialogController({
builder: DetailDialog({
name: this.getName(),
...
...
@@ -104,6 +109,13 @@ export struct PlayerTitleView {
this.summary = this.getSummary()
}
private updateSummaryLines() {
this.summaryLines = Math.max(1, 4 - this.titleLines)
this.isOverLines = this.summary.length > this.clipText(this.summary, 14, this.summaryLines, this.windowWidth - 150 - vp2px(50)).length
}
build() {
Column() {
if (this.getName()) {
...
...
@@ -133,7 +145,10 @@ export struct PlayerTitleView {
.fontFamily('PingFang SC-Regular')
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ bottom: 2 }) //8
.onAreaChange((oldArea: Area, newArea: Area) => {
this.titleLines = Math.ceil((newArea.height as number) / 20) // 20是行高
this.updateSummaryLines()
})
/**
* 标题大于三行或存在简介显示查看详情按钮
*/
...
...
@@ -161,7 +176,7 @@ export struct PlayerTitleView {
// } else {
if(this.summary) {
Text() {
Span(this.clipText(this.summary, 14,
3
, this.windowWidth - 150 - vp2px(50)))
Span(this.clipText(this.summary, 14,
this.summaryLines
, this.windowWidth - 150 - vp2px(50)))
.fontSize(14)
.fontColor(Color.White)
.lineHeight(21)
...
...
Please
register
or
login
to post a comment