From bdaee2fe4752aff955c94277297bcf18d8bb7614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=8B=A4=E6=B0=91?= Date: Thu, 17 Oct 2024 14:28:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E8=88=AA=E6=A0=8F=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E6=98=BE=E9=9A=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/ets/view/SafeView.ets | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/ets/view/SafeView.ets b/src/main/ets/view/SafeView.ets index 64b28ff..d22b4ca 100644 --- a/src/main/ets/view/SafeView.ets +++ b/src/main/ets/view/SafeView.ets @@ -22,7 +22,11 @@ export struct SafeView { // 设置导航栏背景不透明度 // 元素的不透明度,取值范围为0到1,1表示不透明,0表示完全透明, 达到隐藏组件效果,但是在布局中占位。 @Prop opacitys: number | Resource - // 设置返回按钮事件 + // 是否显示返回按钮 + @Prop hideBack: boolean + @Prop showBadgeLeft: boolean; + @Prop showBadgeRight: boolean; + // 设置返回按钮事件,如果hideBack为true,该事件无效 onBackEvent?: () => void = undefined // 设置返回按钮事件 onClickLeft?: TitleBarBtn @@ -60,12 +64,12 @@ export struct SafeView { .height(15) .objectFit(ImageFit.Contain) .onClick(() => { - if (this.onBackEvent) { + if (this.onBackEvent && !this.hideBack) { this.onBackEvent() } else if (this.pageInfos) { this.pageInfos.pop() } - }) + }).visibility(!this.hideBack ? Visibility.Visible : Visibility.None) }.width(110) Text(`${this.titleText}`)