ref |> 调整评论弹框滑动评论时,固定全部评论标题栏
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Showing
2 changed files
with
36 additions
and
8 deletions
| @@ -23,6 +23,7 @@ const testString = 'å› ä¸ºè¯»ä¹¦çš„äºº\n是低ç€å¤´å‘上看的人\nèº«å¤„ä¸€éš | @@ -23,6 +23,7 @@ const testString = 'å› ä¸ºè¯»ä¹¦çš„äºº\n是低ç€å¤´å‘上看的人\nèº«å¤„ä¸€éš | ||
| 23 | export struct CommentComponent { | 23 | export struct CommentComponent { |
| 24 | private onCloseClick = () => { | 24 | private onCloseClick = () => { |
| 25 | } | 25 | } |
| 26 | + showTitleComponent: boolean = true | ||
| 26 | @Prop showCloseIcon?: boolean = false | 27 | @Prop showCloseIcon?: boolean = false |
| 27 | @State hasMore: boolean = true; | 28 | @State hasMore: boolean = true; |
| 28 | @State currentPage: number = 1; | 29 | @State currentPage: number = 1; |
| @@ -168,7 +169,9 @@ export struct CommentComponent { | @@ -168,7 +169,9 @@ export struct CommentComponent { | ||
| 168 | build() { | 169 | build() { |
| 169 | Column() { | 170 | Column() { |
| 170 | List({ scroller: this.listScroller }) { | 171 | List({ scroller: this.listScroller }) { |
| 172 | + if (this.showTitleComponent) { | ||
| 171 | ListItemGroup({ header: this.titleHeader() }) | 173 | ListItemGroup({ header: this.titleHeader() }) |
| 174 | + } | ||
| 172 | 175 | ||
| 173 | if (!this.isComments) { | 176 | if (!this.isComments) { |
| 174 | EmptyComponent({ emptyType: 17 }) | 177 | EmptyComponent({ emptyType: 17 }) |
| @@ -88,17 +88,13 @@ struct CommentListDialog { | @@ -88,17 +88,13 @@ struct CommentListDialog { | ||
| 88 | 88 | ||
| 89 | build() { | 89 | build() { |
| 90 | Column() { | 90 | Column() { |
| 91 | + this.titleHeaderView() | ||
| 92 | + | ||
| 91 | CommentComponent({ | 93 | CommentComponent({ |
| 92 | publishCommentModel: this.publishCommentModel, | 94 | publishCommentModel: this.publishCommentModel, |
| 93 | - showCloseIcon: true, | ||
| 94 | fixedHeightMode: true, | 95 | fixedHeightMode: true, |
| 95 | - onCloseClick: () => { | ||
| 96 | - this.controller!.close() | ||
| 97 | - if (this.onClose) { | ||
| 98 | - this.onClose() | ||
| 99 | - } | ||
| 100 | - }, | ||
| 101 | - inDialog: true | 96 | + inDialog: true, |
| 97 | + showTitleComponent: false | ||
| 102 | }).layoutWeight(1) | 98 | }).layoutWeight(1) |
| 103 | 99 | ||
| 104 | OperRowListView({ | 100 | OperRowListView({ |
| @@ -119,4 +115,33 @@ struct CommentListDialog { | @@ -119,4 +115,33 @@ struct CommentListDialog { | ||
| 119 | .height(this.windowHeight - this.windowWidth * 9 / 16 + 'px') | 115 | .height(this.windowHeight - this.windowWidth * 9 / 16 + 'px') |
| 120 | .backgroundColor(Color.White) | 116 | .backgroundColor(Color.White) |
| 121 | } | 117 | } |
| 118 | + | ||
| 119 | + @Builder titleHeaderView() { | ||
| 120 | + Row() { | ||
| 121 | + Row() { | ||
| 122 | + Image($r('app.media.redLine')) | ||
| 123 | + .height(16) | ||
| 124 | + .width(3) | ||
| 125 | + Text('全部评论') | ||
| 126 | + .fontSize(18)// .fontColor('#222222') | ||
| 127 | + .fontColor($r('app.color.color_222222')) | ||
| 128 | + .fontWeight(FontWeight.Medium) | ||
| 129 | + .margin({ left: 5 }) | ||
| 130 | + } | ||
| 131 | + .margin({ left: 16 }) | ||
| 132 | + | ||
| 133 | + Image($r('app.media.close_button')) | ||
| 134 | + .height(16) | ||
| 135 | + .width(16) | ||
| 136 | + .margin({ right: 16 })// .visibility(this.showCloseIcon ? Visibility.Visible : Visibility.Hidden) | ||
| 137 | + .onClick(() => { | ||
| 138 | + if (this.onClose) { | ||
| 139 | + this.onClose() | ||
| 140 | + } | ||
| 141 | + }) | ||
| 142 | + } | ||
| 143 | + .height(44) | ||
| 144 | + .width('100%') | ||
| 145 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 146 | + } | ||
| 122 | } | 147 | } |
-
Please register or login to post a comment