导航栏右侧按钮添加构建函数和其他
This commit is contained in:
parent
3cce02a36a
commit
e0efb15e61
@ -1,5 +1,4 @@
|
||||
import { router } from '@kit.ArkUI'
|
||||
import { emitter } from '@kit.BasicServicesKit'
|
||||
|
||||
@Builder
|
||||
function defaultBuilder(): void {
|
||||
@ -35,13 +34,8 @@ export struct HdNav {
|
||||
@BuilderParam
|
||||
menuBuilder: () => void = defaultBuilder
|
||||
|
||||
// 添加右侧点击处理
|
||||
private onRightItemClick() {
|
||||
emitter.emit({
|
||||
eventId: 250516,
|
||||
priority: emitter.EventPriority.HIGH
|
||||
})
|
||||
}
|
||||
// 添加右侧点击函数
|
||||
private rightItemAction:()=> void = () => {};
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
@ -84,15 +78,15 @@ export struct HdNav {
|
||||
.size({ width: 24, height: 24 })
|
||||
.objectFit(ImageFit.Contain)
|
||||
.bindMenu(this.menuBuilder)
|
||||
.onClick(()=>this.onRightItemClick())
|
||||
.onClick(()=>this.rightItemAction())
|
||||
}
|
||||
.size({ width: 50, height: 50 })
|
||||
.size({ width: 50, height: 50 }).justifyContent(FlexAlign.End)
|
||||
|
||||
} else if (this.showRightText) {
|
||||
Text(this.rightText)
|
||||
.fontSize(16)
|
||||
.fontColor(this.textColor)
|
||||
.onClick(()=>this.onRightItemClick())
|
||||
.onClick(()=>this.rightItemAction())
|
||||
.width(50)
|
||||
.textAlign(TextAlign.Center)
|
||||
// .margin({right:10})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user