导航栏红点

这个提交包含在:
徐勤民 2024-10-17 14:36:48 +08:00
父节点 bdaee2fe47
当前提交 43996176cf

查看文件

@ -84,13 +84,29 @@ export struct SafeView {
Row() {
if (!this.onClickLeft?.img && this.onClickLeft) {
Badge({
count:this.showBadgeLeft?1:0,
style:{
badgeSize:6,
badgeColor: Color.Red
}
}){
Text(`${this.onClickLeft?.text}` ?? '确定')
.fontColor(this.onClickLeft?.color ?? '#17171A')
.onClick(() => {
this.onClickLeft?.onClick && this.onClickLeft?.onClick()
})
}
if (this.onClickLeft?.img) {
}
if (this.onClickLeft?.img && this.onClickLeft) {
Badge({
count:this.showBadgeLeft?1:0,
style:{
badgeSize:6,
badgeColor: '#FF6500',
color: '#FF6500'
}
}){
Image(this.onClickLeft.img)
.onClick(() => {
this.onClickLeft?.onClick && this.onClickLeft?.onClick()
@ -99,7 +115,16 @@ export struct SafeView {
.width(20)
.height(20)
}
}
if (!this.onClickRight?.img && this.onClickRight) {
Badge({
count:this.showBadgeRight?1:0,
style:{
badgeSize:6,
badgeColor: '#FF6500',
color: '#FF6500'
}
}){
Text(this.onClickRight?.text ?? '确定')
.fontColor(this.onClickRight?.color ?? '#17171A')
.onClick(() => {
@ -109,7 +134,16 @@ export struct SafeView {
left: 10
})
}
if (this.onClickRight?.img) {
}
if (this.onClickRight?.img && this.onClickRight) {
Badge({
count:this.showBadgeRight?1:0,
style:{
badgeSize:6,
badgeColor: '#FF6500',
color: '#FF6500'
}
}){
Image(this.onClickRight.img)
.onClick(() => {
this.onClickRight?.onClick && this.onClickRight?.onClick()
@ -121,6 +155,7 @@ export struct SafeView {
left: 10
})
}
}
}.width(110)
.justifyContent(FlexAlign.End)