导航栏右侧按钮添加构建函数和其他
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
import { router } from '@kit.ArkUI'
|
||||
import { emitter } from '@kit.BasicServicesKit'
|
||||
import { BasicConstant } from '../../../../Index'
|
||||
|
||||
@Component
|
||||
export struct HdSearchNav {
|
||||
private rightItemAction: (value: string) => void = () => {};
|
||||
@StorageProp('topHeight')
|
||||
topHeight: number = 0
|
||||
@Prop
|
||||
bgColor: ResourceStr = $r('app.color.top_bg')
|
||||
@Prop
|
||||
hasBorder: boolean = false
|
||||
@Prop
|
||||
leftIcon: ResourceStr = $r('app.media.top_back')
|
||||
@Prop
|
||||
showRightIcon: boolean = true
|
||||
@Prop
|
||||
rightIcon: ResourceStr
|
||||
@Prop
|
||||
showRightText: boolean = false
|
||||
@Prop
|
||||
rightText: string = ''
|
||||
@Prop
|
||||
rightTextColor: ResourceStr
|
||||
@Prop
|
||||
rightbackColor: ResourceStr = $r('app.color.main_color')
|
||||
|
||||
@State textInputContent:string = ''
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
Row() {
|
||||
Image(this.leftIcon)
|
||||
.size({ width: 24, height: 24 })
|
||||
.onClick(() => router.back())
|
||||
.fillColor($r('app.color.black'))
|
||||
}.size({ width: 50, height: 50 })
|
||||
|
||||
Row({space:10}){
|
||||
Image($r('app.media.selected_hospital_ws'))
|
||||
.width(25).height(25)
|
||||
.margin({left:15})
|
||||
TextInput({placeholder:'搜索视频、过往会议'})
|
||||
.fontSize(15)
|
||||
.margin({left:10})
|
||||
.onChange((value:string)=>{
|
||||
this.textInputContent = value;
|
||||
})
|
||||
}
|
||||
.borderWidth(0.5).borderRadius(3).borderColor($r('app.color.main_color')).justifyContent(FlexAlign.Start)
|
||||
|
||||
if (this.showRightIcon) {
|
||||
Row() {
|
||||
Image(this.rightIcon)
|
||||
.size({ width: 24, height: 24 })
|
||||
.objectFit(ImageFit.Contain)
|
||||
.onClick(()=>this.rightItemAction(this.textInputContent))
|
||||
}
|
||||
.size({ width: 50, height: 50 }).justifyContent(FlexAlign.End)
|
||||
} else if (this.showRightText) {
|
||||
Text(this.rightText)
|
||||
.fontSize(16)
|
||||
.fontColor(this.rightTextColor)
|
||||
.backgroundColor(this.rightbackColor)
|
||||
.borderRadius(4)
|
||||
.onClick(()=>this.rightItemAction(this.textInputContent))
|
||||
.width(50)
|
||||
.textAlign(TextAlign.Center)
|
||||
} else {
|
||||
Blank()
|
||||
.width(50)
|
||||
}
|
||||
}
|
||||
.padding({ left: 16, right: 16, top: this.topHeight })
|
||||
.height(56 + this.topHeight)
|
||||
.width('100%')
|
||||
.backgroundColor(this.bgColor)
|
||||
}
|
||||
}
|
||||
@@ -45,4 +45,7 @@ export class BasicConstant {
|
||||
'广西壮族自治区','海南省','重庆市','四川省','贵州省','云南省','西藏自治区',
|
||||
'陕西省','甘肃省','宁夏回族自治区','新疆维吾尔自治区','台湾省','香港特别行政区','澳门特别行政区']
|
||||
|
||||
}
|
||||
//通知事件ID
|
||||
static readonly notification_back_refreshData = 250529;//返回上页通知刷新数据
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user