69 lines
2.8 KiB
Plaintext
69 lines
2.8 KiB
Plaintext
import { hilog } from '@kit.PerformanceAnalysisKit';
|
|
import { TitleButton} from '../LayoutInterface/Interface/ButtonInterface';
|
|
import { TitleGroup} from '../LayoutInterface/Interface/GroupInterface';
|
|
import {GroupTextEventMenu} from '../CustomController/Menu'
|
|
import {EventBtn,MenuBtn} from '../CustomController/Button'
|
|
import { TitleModel } from '../LayoutInterface/Layout/TitleTabData';
|
|
|
|
@ComponentV2
|
|
export struct TitleTabContent {
|
|
|
|
@Param curtLayout:TitleModel|undefined=undefined;
|
|
|
|
build() {
|
|
//垂直布局展示多行
|
|
Column({ space: 0 }) {
|
|
//迭代生成行容器
|
|
ForEach(this.curtLayout?.cmEvents, (row_items: Array<TitleButton|Array<TitleGroup>|Array<TitleButton>>, mIndex: number) => {
|
|
//行的按钮组容器
|
|
Row({ space: 1 }){
|
|
ForEach(row_items, (row_item: TitleButton|Array<TitleGroup>|Array<TitleButton>, index: number) => {
|
|
if(!Array.isArray(row_item)){//TitleButton
|
|
//单按钮
|
|
EventBtn({eventBtn:row_item})
|
|
}else if(row_item instanceof Array<TitleGroup>){ //Array<TitleGroup>
|
|
//功能组,迭代多个功能组
|
|
ForEach(row_item, (group_item: TitleGroup, index: number) =>{
|
|
Column({ space:10 }){
|
|
Row({ space: 1 }){
|
|
ForEach(group_item.grpBtn, (btn_item: TitleButton|Array<TitleButton>, index: number) =>{
|
|
if(this.curtLayout?.cmName=='应用模块'){
|
|
if(Array.isArray(btn_item)){
|
|
MenuBtn({menus:btn_item})
|
|
}else{
|
|
EventBtn({eventBtn:btn_item,eventBtnType:true})
|
|
}
|
|
}else{
|
|
if(Array.isArray(btn_item)){
|
|
MenuBtn({menus:btn_item})
|
|
}else{
|
|
EventBtn({eventBtn:btn_item})
|
|
}
|
|
}
|
|
})
|
|
}.margin({ top: 1,left:10,bottom:1,right:10})
|
|
//功能组名
|
|
Row(){
|
|
GroupTextEventMenu({grpEvent:group_item})
|
|
}.margin({ top: 0,left:0,bottom:-5,right:0})
|
|
}
|
|
Divider().vertical(true).strokeWidth(1).lineCap(LineCapStyle.Round).height('95%').backgroundColor(Color.Gray)
|
|
})
|
|
}else{
|
|
//菜单按钮
|
|
Column(){
|
|
Button((row_item as Array<TitleButton>)[0].eName)
|
|
.height('95%')
|
|
.width('50')
|
|
.padding('1')
|
|
.type(ButtonType.Normal)
|
|
}
|
|
}
|
|
})
|
|
}.width('100%')
|
|
.align(Alignment.BottomEnd)
|
|
.borderColor(Color.Gray)
|
|
})
|
|
}.margin({ top: 5,left:1,bottom:1,right:1})
|
|
}
|
|
} |