ref |> 调整评论输入框发布按钮高亮逻辑
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Showing
1 changed file
with
10 additions
and
1 deletions
| @@ -15,6 +15,7 @@ export struct CommentCustomDialog { | @@ -15,6 +15,7 @@ export struct CommentCustomDialog { | ||
| 15 | @State private emojiSwitch: boolean = false | 15 | @State private emojiSwitch: boolean = false |
| 16 | textInputController: TextAreaController = new TextAreaController() | 16 | textInputController: TextAreaController = new TextAreaController() |
| 17 | @State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 } | 17 | @State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 } |
| 18 | + @State publishButtonOpacity: number = 0.5 | ||
| 18 | 19 | ||
| 19 | aboutToAppear(): void { | 20 | aboutToAppear(): void { |
| 20 | } | 21 | } |
| @@ -55,8 +56,15 @@ export struct CommentCustomDialog { | @@ -55,8 +56,15 @@ export struct CommentCustomDialog { | ||
| 55 | .height('100%') | 56 | .height('100%') |
| 56 | .width('100%') | 57 | .width('100%') |
| 57 | .backgroundColor($r('app.color.color_transparent')) | 58 | .backgroundColor($r('app.color.color_transparent')) |
| 59 | + .caretColor("#ED2800") | ||
| 58 | .onChange(value => { | 60 | .onChange(value => { |
| 59 | this.publishCommentModel.commentContent = value; | 61 | this.publishCommentModel.commentContent = value; |
| 62 | + | ||
| 63 | + if (value.length > 0) { | ||
| 64 | + this.publishButtonOpacity = 1.0 | ||
| 65 | + } else { | ||
| 66 | + this.publishButtonOpacity = 0.5 | ||
| 67 | + } | ||
| 60 | }) | 68 | }) |
| 61 | .onFocus(() => { | 69 | .onFocus(() => { |
| 62 | if (this.emojiSwitch) { | 70 | if (this.emojiSwitch) { |
| @@ -98,13 +106,14 @@ export struct CommentCustomDialog { | @@ -98,13 +106,14 @@ export struct CommentCustomDialog { | ||
| 98 | 106 | ||
| 99 | Row() { | 107 | Row() { |
| 100 | Text('发布') | 108 | Text('发布') |
| 101 | - .backgroundColor('#F89381') | 109 | + .backgroundColor("#ED2800") |
| 102 | .width(80) | 110 | .width(80) |
| 103 | .height(30) | 111 | .height(30) |
| 104 | .fontSize(15) | 112 | .fontSize(15) |
| 105 | .fontColor(Color.White) | 113 | .fontColor(Color.White) |
| 106 | .textAlign(TextAlign.Center) | 114 | .textAlign(TextAlign.Center) |
| 107 | .borderRadius(4) | 115 | .borderRadius(4) |
| 116 | + .opacity(this.publishButtonOpacity) | ||
| 108 | .onClick(() => { | 117 | .onClick(() => { |
| 109 | if (this.publishCommentModel.commentContent.length > 0) { | 118 | if (this.publishCommentModel.commentContent.length > 0) { |
| 110 | //请求评论接口 | 119 | //请求评论接口 |
-
Please register or login to post a comment