From ef3dd1bd00cf89df63a97214a13685466b224e58 Mon Sep 17 00:00:00 2001 From: liugang9704 <2745340733@qq.com> Date: Thu, 18 Sep 2025 15:39:31 +0800 Subject: [PATCH 1/2] =?UTF-8?q?update:=20=E4=BF=AE=E6=94=B9README=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E4=B8=AD=E7=9A=84=E5=B7=A5=E7=A8=8B=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.en.md b/README.en.md index 7895fca..7c3fc0c 100644 --- a/README.en.md +++ b/README.en.md @@ -1,4 +1,4 @@ -# Implementing Fixed-Style and Custom Dialog Boxes +# Implement various pop-up window functions based on ArkUI ## Overview This sample describes how to add custom dialog boxes and the following fixed-style dialog boxes to an application: popup, toast, date picker, text picker, and alert dialog boxes. You can use the system APIs to pass in related parameters to implement fixed-style dialog boxes. For custom dialog boxes, you can define the style and interaction mode to handle more complex scenarios. diff --git a/README.md b/README.md index eef6c9d..c75da54 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# 实现固定样式和自定义样式弹窗 +# 基于ArkUI实现多种样式弹窗功能 ## 简介 -- Gitee From b5037d85951ba6eca57fa57594a2c8e5bf112115 Mon Sep 17 00:00:00 2001 From: liugang9704 <2745340733@qq.com> Date: Thu, 18 Sep 2025 15:49:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?update:=20=E6=B7=BB=E5=8A=A0try/catch?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/utils/CommonUtils.ets | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/entry/src/main/ets/utils/CommonUtils.ets b/entry/src/main/ets/utils/CommonUtils.ets index 9930303..78973fd 100644 --- a/entry/src/main/ets/utils/CommonUtils.ets +++ b/entry/src/main/ets/utils/CommonUtils.ets @@ -12,6 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { hilog } from "@kit.PerformanceAnalysisKit"; +import { BusinessError } from "@kit.BasicServicesKit"; class HobbyItem { label?: string; @@ -23,10 +25,19 @@ const context = uiContext?.getHostContext(); export class CommonUtils { getBirthDateValue(year: number, month: number, day: number): string { - let resourceYear = context?.resourceManager.getStringSync($r('app.string.year')); - let resourceMonth = context?.resourceManager.getStringSync($r('app.string.month')); - let resourceDay = context?.resourceManager.getStringSync($r('app.string.day')); - let birthdate: string = `${year}${resourceYear}${month}` + `${resourceMonth}${day}${resourceDay}`; + let resourceYear: string | undefined = ''; + let resourceMonth: string | undefined = ''; + let resourceDay: string | undefined = ''; + let birthdate: string | undefined = ''; + try { + resourceYear = context?.resourceManager.getStringSync($r('app.string.year').id); + resourceMonth = context?.resourceManager.getStringSync($r('app.string.month').id); + resourceDay = context?.resourceManager.getStringSync($r('app.string.day').id); + birthdate = `${year}${resourceYear}${month}` + `${resourceMonth}${day}${resourceDay}`; + } catch (error) { + let err = error as BusinessError; + hilog.error(0x0000, '', `getStringSync failed. code=${err.code},message=${err.message}`); + } return birthdate; } -- Gitee