Răsfoiți Sursa

feat(basic): 为列表对话框添加对齐方式设置

- 在 ListOptions 接口中添加 alignment 属性,用于设置对话框的对齐方式
- 修改 ToolsHelper 类中的 showListDialog 方法,支持根据 options.alignment 设置对齐方式
徐勤民 5 luni în urmă
părinte
comite
45187bc8b6
1 a modificat fișierele cu 3 adăugiri și 1 ștergeri
  1. 3 1
      src/main/ets/utils/ToolsHelper.ets

+ 3 - 1
src/main/ets/utils/ToolsHelper.ets

@@ -28,6 +28,7 @@ export interface ConfirmOptions {
 export interface ListOptions<T> {
   title?: string
   cancel?: Btn
+  alignment?: DialogAlignment
   values: Array<T>
   onSelected: (index: number, value: T) => void
   onError?: (msg: string) => void
@@ -102,6 +103,7 @@ interface ThrottleInterface {
 export class ToolsHelper {
   private constructor() {
   }
+
   /**
    * 弹出Toast
    * @param msg
@@ -233,7 +235,7 @@ export class ToolsHelper {
     } else {
       const dialogTag = ToolsHelper.getUuid()
       promptAction.openCustomDialog({
-        alignment: DialogAlignment.Bottom,
+        alignment: options.alignment ?? DialogAlignment.Bottom,
         builder: customDialogBuilder.bind(p, options, dialogTag)
       }).then((dialogId: number) => {
         ToolsHelper.mapDialog.set(dialogTag, dialogId)