70 lines
2.9 KiB
Plaintext
70 lines
2.9 KiB
Plaintext
import { hilog } from '@kit.PerformanceAnalysisKit';
|
|
import { TitleButton} from '../LayoutInterface/Interface/TitleButtonInterface';
|
|
import { TitleGroup} from '../LayoutInterface/Interface/TitleGroupInterface';
|
|
import {GroupTextEventMenu} from '../CustomStyle/StyleMenu'
|
|
import {EventBtn,MenuBtn} from '../CustomStyle/StyleButton'
|
|
|
|
@ComponentV2
|
|
export struct TitleTabContent {
|
|
@Param tabLayout:Array<Array<TitleButton|Array<TitleGroup>|Array<TitleButton>>>=[];
|
|
build() {
|
|
//垂直布局展示多行
|
|
Column({ space: 0 }) {
|
|
//迭代生成行容器
|
|
ForEach(this.tabLayout, (row_items: Array<TitleButton|Array<TitleGroup>|Array<TitleButton>>, mIndex: number) => {
|
|
//行的按钮组容器
|
|
Row(){
|
|
ForEach(row_items, (row_item: TitleButton|Array<TitleGroup>|Array<TitleButton>, index: number) => {
|
|
//首先判断是否为数组.如果不为数组者为BtnEvent
|
|
if(!Array.isArray(row_item)){
|
|
//单按钮
|
|
EventBtn({eventBtn:row_item})
|
|
}else if(row_item instanceof Array<TitleGroup>){
|
|
//功能组,迭代多个功能组
|
|
ForEach(row_item, (group_item: TitleGroup, index: number) =>{
|
|
Column({ space: 5 }){
|
|
Row({ space: 1 }){
|
|
ForEach(group_item.grpBtn, (btn_item: TitleButton|Array<TitleButton>, index: number) =>{
|
|
//如果是数组则为菜单按钮否则为单功能按钮
|
|
if(Array.isArray(btn_item)){
|
|
MenuBtn({menuBtn:btn_item})
|
|
}else{
|
|
//针对最后一个Bar特化处理.如果为最后一个Bar则在子组件Image真假onClick事件
|
|
if(mIndex==this.tabLayout.length-1){
|
|
EventBtn({eventBtn:btn_item,modelType:1})
|
|
}else{
|
|
EventBtn({eventBtn:btn_item})
|
|
}
|
|
}
|
|
})
|
|
}.margin({ top: 1,left:1,bottom:1,right:1})
|
|
//功能组名
|
|
GroupTextEventMenu({grpEvent:group_item})
|
|
}.borderWidth(1)
|
|
.borderColor(Color.Grey)
|
|
})
|
|
}else{
|
|
//菜单按钮
|
|
Column(){
|
|
Button((row_item as Array<TitleButton>)[0].eName)
|
|
.height('95%')
|
|
.width('50')
|
|
.padding('1')
|
|
.type(ButtonType.Normal)
|
|
Button()
|
|
.height('5%')
|
|
.width('50')
|
|
.padding('1')
|
|
.type(ButtonType.Normal)
|
|
//.bindMenu(this.BtnMenu((row_item as Array<BtnEvent>)))
|
|
}
|
|
}
|
|
})
|
|
}
|
|
.width('100%')
|
|
.align(Alignment.BottomEnd)
|
|
.borderColor(Color.Gray)
|
|
})
|
|
}.margin({ top: 1,left:1,bottom:1,right:1})
|
|
}
|
|
} |