ソースを参照

refactor(basic): 优化弹窗提示文案显示

- 在弹窗提示中添加滚动功能,以支持长文本显示
- 设置最大高度限制,避免过长的提示文本导致界面变形
徐勤民 1 週間 前
コミット
37a12ef1fd
1 ファイル変更16 行追加11 行削除
  1. 16 11
      src/main/ets/utils/ToolsHelper.ets

+ 16 - 11
src/main/ets/utils/ToolsHelper.ets

@@ -181,17 +181,22 @@ function alertDialogBuilder(options: AlertBean) {
     .alignItems(VerticalAlign.Top)
     .padding(9)
 
-    Text(options.options.msg)
-      .fontSize(14)
-      .fontWeight(FontWeight.Medium)
-      .fontColor($r('sys.color.black'))
-      .textAlign(TextAlign.Center)
-      .lineHeight(20)
-      .padding({
-        left: 19,
-        right: 19
-      })
-      .width('100%')
+    Scroll(){
+      Text(options.options.msg)
+        .fontSize(14)
+        .fontWeight(FontWeight.Medium)
+        .fontColor($r('sys.color.black'))
+        .textAlign(TextAlign.Center)
+        .lineHeight(20)
+        .padding({
+          left: 19,
+          right: 19
+        })
+        .width('100%')
+    }.scrollable(ScrollDirection.Vertical)
+    .constraintSize({
+      maxHeight: 220
+    })
     Text(options.options.confirm?.text ?? '确定')
       .fontSize(14)
       .fontWeight(FontWeight.Medium)