Page主要针对Arkui侧的子窗口事件 Event主要针对Native侧的事件. 后续考虑解耦为如下: Arkui_Page(主要针对子窗口归一化调用) Arkui_Event(主要针对arkui侧的归一化动态组件操作) Native_Page(主要针对Native侧对Arkui侧的页面数据更新和回调) Native_Event(主要针对单一从Aarkui侧调用Native指令) 本次更新后btnEvent中增加了page地址和args.可以在预置功能中预置命令和参数.
72 lines
2.9 KiB
Plaintext
72 lines
2.9 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/Interface/ModelInterface'
|
|
|
|
@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: 2 }){
|
|
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:5 }){
|
|
Row({ space: 5 }){
|
|
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})
|
|
}
|
|
}
|
|
})
|
|
}
|
|
//功能组名
|
|
Row(){
|
|
GroupTextEventMenu({grpEvent:group_item})
|
|
}
|
|
}.height('100%')
|
|
.margin({ top:0, left: 10, bottom: 0, right: 10 })
|
|
Divider().vertical(true).strokeWidth(1).lineCap(LineCapStyle.Round).height('90%').backgroundColor(Color.Grey)
|
|
})
|
|
}else{
|
|
//菜单按钮
|
|
Column(){
|
|
Button((row_item as Array<TitleButton>)[0].btnName)
|
|
.height('95%')
|
|
.width('50')
|
|
.padding('1')
|
|
.type(ButtonType.Normal)
|
|
}
|
|
}
|
|
})
|
|
}.width('100%')
|
|
.height('100%')
|
|
.align(Alignment.BottomEnd)
|
|
.borderColor(Color.Grey)
|
|
})
|
|
}.width('100%')
|
|
.height('100%')
|
|
}
|
|
} |