SafeView.ets

这个提交包含在:
徐勤民 2024-10-20 15:05:08 +08:00
父节点 919151b0fa
当前提交 72a5497762

查看文件

@ -11,7 +11,7 @@ export interface TitleBarBtn {
@Preview @Preview
@Component @Component
export struct SafeView { export struct SafeView {
@Consume('pageInfos') pageInfos?: NavPathStack pageInfos?: NavPathStack
@Prop isLoading: boolean @Prop isLoading: boolean
// 是不是沉浸式 // 是不是沉浸式
@Prop isImmersive: boolean @Prop isImmersive: boolean
@ -96,12 +96,12 @@ export struct SafeView {
Row() { Row() {
if (!this.onClickLeft?.img && this.onClickLeft) { if (!this.onClickLeft?.img && this.onClickLeft) {
Badge({ Badge({
count:this.showBadgeLeft?1:0, count: this.showBadgeLeft ? 1 : 0,
style:{ style: {
badgeSize:6, badgeSize: 6,
badgeColor: Color.Red badgeColor: Color.Red
} }
}){ }) {
Text(`${this.onClickLeft?.text}` ?? '确定') Text(`${this.onClickLeft?.text}` ?? '确定')
.fontColor(this.onClickLeft?.color ?? '#17171A') .fontColor(this.onClickLeft?.color ?? '#17171A')
.onClick(() => { .onClick(() => {
@ -111,13 +111,13 @@ export struct SafeView {
} }
if (this.onClickLeft?.img && this.onClickLeft) { if (this.onClickLeft?.img && this.onClickLeft) {
Badge({ Badge({
count:this.showBadgeLeft?1:0, count: this.showBadgeLeft ? 1 : 0,
style:{ style: {
badgeSize:6, badgeSize: 6,
badgeColor: '#FF6500', badgeColor: '#FF6500',
color: '#FF6500' color: '#FF6500'
} }
}){ }) {
Image(this.onClickLeft.img) Image(this.onClickLeft.img)
.onClick(() => { .onClick(() => {
this.onClickLeft?.onClick && this.onClickLeft?.onClick() this.onClickLeft?.onClick && this.onClickLeft?.onClick()
@ -129,13 +129,13 @@ export struct SafeView {
} }
if (!this.onClickRight?.img && this.onClickRight) { if (!this.onClickRight?.img && this.onClickRight) {
Badge({ Badge({
count:this.showBadgeRight?1:0, count: this.showBadgeRight ? 1 : 0,
style:{ style: {
badgeSize:6, badgeSize: 6,
badgeColor: '#FF6500', badgeColor: '#FF6500',
color: '#FF6500' color: '#FF6500'
} }
}){ }) {
Text(this.onClickRight?.text ?? '确定') Text(this.onClickRight?.text ?? '确定')
.fontColor(this.onClickRight?.color ?? '#17171A') .fontColor(this.onClickRight?.color ?? '#17171A')
.onClick(() => { .onClick(() => {
@ -148,13 +148,13 @@ export struct SafeView {
} }
if (this.onClickRight?.img && this.onClickRight) { if (this.onClickRight?.img && this.onClickRight) {
Badge({ Badge({
count:this.showBadgeRight?1:0, count: this.showBadgeRight ? 1 : 0,
style:{ style: {
badgeSize:6, badgeSize: 6,
badgeColor: '#FF6500', badgeColor: '#FF6500',
color: '#FF6500' color: '#FF6500'
} }
}){ }) {
Image(this.onClickRight.img) Image(this.onClickRight.img)
.onClick(() => { .onClick(() => {
this.onClickRight?.onClick && this.onClickRight?.onClick() this.onClickRight?.onClick && this.onClickRight?.onClick()
@ -208,14 +208,17 @@ export struct SafeView {
.hideTitleBar(true) .hideTitleBar(true)
.width('100%') .width('100%')
.height('100%') .height('100%')
.backgroundColor(this.backgroundColorView??'#ffffff') .backgroundColor(this.backgroundColorView ?? '#ffffff')
.onBackPressed(() => { .onBackPressed(() => {
if (this.onBackEvent) { if (this.onBackEvent) {
this.onBackEvent() this.onBackEvent()
return true
} else if (this.pageInfos) { } else if (this.pageInfos) {
this.pageInfos.pop() this.pageInfos.pop()
return true
} else {
return false
} }
return true
}) })
} }
} }