From 45187bc8b6e38ec8593f25250e7b554fa18ec58d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=8B=A4=E6=B0=91?= Date: Tue, 5 Nov 2024 18:40:04 +0800 Subject: [PATCH] =?UTF-8?q?feat(basic):=20=E4=B8=BA=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=A1=86=E6=B7=BB=E5=8A=A0=E5=AF=B9=E9=BD=90?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 ListOptions 接口中添加 alignment 属性,用于设置对话框的对齐方式 - 修改 ToolsHelper 类中的 showListDialog 方法,支持根据 options.alignment 设置对齐方式 --- src/main/ets/utils/ToolsHelper.ets | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/ets/utils/ToolsHelper.ets b/src/main/ets/utils/ToolsHelper.ets index 35a6667..4e0e713 100644 --- a/src/main/ets/utils/ToolsHelper.ets +++ b/src/main/ets/utils/ToolsHelper.ets @@ -28,6 +28,7 @@ export interface ConfirmOptions { export interface ListOptions { title?: string cancel?: Btn + alignment?: DialogAlignment values: Array 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)