导航栏返回按钮显隐

这个提交包含在:
徐勤民 2024-10-17 14:28:53 +08:00
父节点 539d8d4c9a
当前提交 bdaee2fe47

查看文件

@ -22,7 +22,11 @@ export struct SafeView {
// 设置导航栏背景不透明度 // 设置导航栏背景不透明度
// 元素的不透明度,取值范围为0到1,1表示不透明,0表示完全透明, 达到隐藏组件效果,但是在布局中占位。 // 元素的不透明度,取值范围为0到1,1表示不透明,0表示完全透明, 达到隐藏组件效果,但是在布局中占位。
@Prop opacitys: number | Resource @Prop opacitys: number | Resource
// 设置返回按钮事件 // 是否显示返回按钮
@Prop hideBack: boolean
@Prop showBadgeLeft: boolean;
@Prop showBadgeRight: boolean;
// 设置返回按钮事件,如果hideBack为true,该事件无效
onBackEvent?: () => void = undefined onBackEvent?: () => void = undefined
// 设置返回按钮事件 // 设置返回按钮事件
onClickLeft?: TitleBarBtn onClickLeft?: TitleBarBtn
@ -60,12 +64,12 @@ export struct SafeView {
.height(15) .height(15)
.objectFit(ImageFit.Contain) .objectFit(ImageFit.Contain)
.onClick(() => { .onClick(() => {
if (this.onBackEvent) { if (this.onBackEvent && !this.hideBack) {
this.onBackEvent() this.onBackEvent()
} else if (this.pageInfos) { } else if (this.pageInfos) {
this.pageInfos.pop() this.pageInfos.pop()
} }
}) }).visibility(!this.hideBack ? Visibility.Visible : Visibility.None)
}.width(110) }.width(110)
Text(`${this.titleText}`) Text(`${this.titleText}`)