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