注册资料
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { router } from '@kit.ArkUI'
|
||||
import { emitter } from '@kit.BasicServicesKit'
|
||||
|
||||
@Builder
|
||||
function defaultBuilder(): void {
|
||||
@@ -34,23 +35,30 @@ export struct HdNav {
|
||||
@BuilderParam
|
||||
menuBuilder: () => void = defaultBuilder
|
||||
|
||||
// 添加右侧点击处理
|
||||
private onRightItemClick() {
|
||||
emitter.emit({
|
||||
eventId: 250516,
|
||||
priority: emitter.EventPriority.HIGH
|
||||
})
|
||||
}
|
||||
|
||||
build() {
|
||||
Row({ space: 16 }) {
|
||||
Row() {
|
||||
if (this.showLeftIcon) {
|
||||
Image(this.leftIcon)
|
||||
.size({ width: 24, height: 24 })
|
||||
.margin({left:-5})
|
||||
.onClick(() => router.back())
|
||||
.fillColor($r('app.color.black'))
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Blank()
|
||||
.width(24)
|
||||
}
|
||||
Row() {
|
||||
if (this.title) {
|
||||
Text(this.title)
|
||||
.fontWeight(600)
|
||||
// .fontWeight(600)
|
||||
.layoutWeight(1)
|
||||
.textAlign(TextAlign.Center)
|
||||
.fontSize(20)
|
||||
@@ -62,6 +70,7 @@ export struct HdNav {
|
||||
}
|
||||
}
|
||||
.height(56)
|
||||
.width(150)
|
||||
.layoutWeight(1)
|
||||
|
||||
if (this.showRightIcon) {
|
||||
@@ -69,14 +78,14 @@ export struct HdNav {
|
||||
.size({ width: 24, height: 24 })
|
||||
.objectFit(ImageFit.Contain)
|
||||
.bindMenu(this.menuBuilder)
|
||||
} else if (this.showRightText)
|
||||
{
|
||||
.onClick(()=>this.onRightItemClick())
|
||||
} else if (this.showRightText) {
|
||||
Text(this.rightText)
|
||||
.fontSize(16)
|
||||
.fontColor(this.textColor)
|
||||
.margin({right:10})
|
||||
}
|
||||
else {
|
||||
.onClick(()=>this.onRightItemClick())
|
||||
// .margin({right:10})
|
||||
} else {
|
||||
Blank()
|
||||
.width(24)
|
||||
}
|
||||
@@ -85,6 +94,5 @@ export struct HdNav {
|
||||
.height(56 + this.topHeight)
|
||||
.width('100%')
|
||||
.backgroundColor(this.bgColor)
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user