From 4c519409d6a850f2b162f53f241d11c512342975 Mon Sep 17 00:00:00 2001 From: liugang9704 <2745340733@qq.com> Date: Tue, 10 Jun 2025 19:17:18 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=90=E7=A7=81=E5=BC=B9=E7=AA=97=E6=B2=89?= =?UTF-8?q?=E6=B5=B8=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- entry/src/main/ets/pages/AgreementPage.ets | 24 ++++++++++++++++++ entry/src/main/ets/pages/CommentList.ets | 13 +++++++--- entry/src/main/ets/pages/Index.ets | 8 +++--- entry/src/main/ets/pages/PrivacyDialog.ets | 23 +++++++++++++++-- .../resources/base/media/chevron_left.png | Bin 0 -> 611 bytes 6 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 entry/src/main/resources/base/media/chevron_left.png diff --git a/README.md b/README.md index b6540d9..22c719c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# **实现自定义样式弹窗** +# **自定义弹窗选型与开发** ## 介绍 本示例主要介绍如何给应用添加自定义样式的弹窗,包括非模态弹窗:文本提示、图文提示、操作提示等;以及模态弹窗:确认弹窗、隐私弹窗、进度条、操作列表、评论回复弹窗等。旨在帮助开发者了解 如何实现这些弹窗,给应用添加这些交互弹窗,也能提升用户体验。 diff --git a/entry/src/main/ets/pages/AgreementPage.ets b/entry/src/main/ets/pages/AgreementPage.ets index c7b0610..9f346f8 100644 --- a/entry/src/main/ets/pages/AgreementPage.ets +++ b/entry/src/main/ets/pages/AgreementPage.ets @@ -16,8 +16,31 @@ // [Start AgreementPage] @Component export struct AgreementPage { + @Consume('NavPathStack') pageStack: NavPathStack; + build() { NavDestination() { + Row(){ + Row() { + Image($r('app.media.chevron_left')) + .width(16) + .height(16) + .margin({ left: 12 }) + } + .width(40) + .height(40) + .borderRadius(48) + .margin({ top: 42 }) + .backgroundColor('#e6eaeb') + .onClick(() => { + this.pageStack.pop(); + }) + } + .width('100%') + .padding({ + left: 16, + right: 16 + }) Scroll() { Column() { Image($r('app.media.privacy')) @@ -83,6 +106,7 @@ export struct AgreementPage { right: 16 }) } + .hideTitleBar(true) .height('100%') .backgroundColor('#F1F3F5') } diff --git a/entry/src/main/ets/pages/CommentList.ets b/entry/src/main/ets/pages/CommentList.ets index b09eb3e..1162aeb 100644 --- a/entry/src/main/ets/pages/CommentList.ets +++ b/entry/src/main/ets/pages/CommentList.ets @@ -180,14 +180,21 @@ export struct CommentList { } }, (item: Person) => JSON.stringify(item)) } - .padding({ left: 16, right: 16 }) + .padding({ + left: 16, + right: 16 + }) .width('100%') .height('auto') this.ToolBar() } - .borderRadius({ topLeft: 16, topRight: 16 }) - .backgroundColor('#F1F3F5') + .padding({ bottom: 32 }) + .borderRadius({ + topLeft: 16, + topRight: 16 + }) + .backgroundColor(Color.White) .onAreaChange(this.onCommentListAreaChange) } } diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index ab801a4..67aaea6 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -576,16 +576,14 @@ struct Index { bottom: 4 }) } + .height('100%') .padding({ + top: 32, + bottom: 36, left: 16, right: 16 }) - .height('100%') } - .padding({ - top: 32, - bottom: 36 - }) .backgroundColor('#F1F3F5') .navDestination(this.PagesMap) .width('100%') diff --git a/entry/src/main/ets/pages/PrivacyDialog.ets b/entry/src/main/ets/pages/PrivacyDialog.ets index 798fa49..bf57df1 100644 --- a/entry/src/main/ets/pages/PrivacyDialog.ets +++ b/entry/src/main/ets/pages/PrivacyDialog.ets @@ -99,6 +99,21 @@ export struct PrivacyDialog { NavDestination() { // [Start privacy_dialog] Column() { + Row() { + Image($r('app.media.chevron_left')) + .width(16) + .height(16) + .margin({ left: 12 }) + } + .width(40) + .height(40) + .borderRadius(48) + .margin({ top: 42 }) + .backgroundColor('#e6eaeb') + .onClick(() => { + this.pageStack.pop(); + }) + Row() { Button('OPEN') .id('privacyDialog') @@ -131,12 +146,16 @@ export struct PrivacyDialog { .height('100%') .padding({ left: 16, - right: 16 + right: 16, + bottom: 32 }) - .justifyContent(FlexAlign.End) + .justifyContent(FlexAlign.SpaceBetween) + .alignItems(HorizontalAlign.Start) + // [End privacy_dialog] } .hideToolBar(true) + .hideTitleBar(true) .width('100%') .height('100%') .backgroundColor('#F1F3F5') diff --git a/entry/src/main/resources/base/media/chevron_left.png b/entry/src/main/resources/base/media/chevron_left.png new file mode 100644 index 0000000000000000000000000000000000000000..158c2c6264e1ddd7cb4e6f3975d8979637eef83c GIT binary patch literal 611 zcmV-p0-XJcP)Px%9Z5t%R7gwh)G>(DU>FAA_iIlF!CPE(aB&dfY$}BO1wk*lIw_81s0r&lfafawlbOrG zy8A9^v0_0@Oq~Vzr3(Mzkjg==@-_);4Zq{c3-cs{*3|94$e`?ha#qt|T|nzK1Lfun zh|l;{cR4K<3u?yH5{R!ULlcI%dyL3t;IKmPdD6KVhbI0U+M$ES(Y-`tHi3;MN<8mX z-P@gLYA_1sjAQ$V8qx6&wIIIZOLuNF+7}oF^P;$)5k`ZW05I!I=l)P&6xQ`4d+OQj xOy}FhetJoJmh`;uBaguU8W?q$v=qtD{{hBnpDCmK!>IrO002ovPDHLkV1kk290~vc literal 0 HcmV?d00001 -- Gitee