60 lines
1.7 KiB
Plaintext
60 lines
1.7 KiB
Plaintext
import { hilog } from '@kit.PerformanceAnalysisKit';
|
|
|
|
|
|
interface LeftSideTabName {
|
|
//标签名
|
|
str: string;
|
|
//图标名
|
|
ico: string;
|
|
//页面名
|
|
page:string;
|
|
}
|
|
|
|
@Component
|
|
export struct LeftSideTab {
|
|
@State leftSideBarTabsName:Array<LeftSideTabName>=[
|
|
{str:'建模树',ico:'',page:''},
|
|
{str:'组装树',ico:'',page:''},
|
|
]
|
|
private leftSideBarTabs: TabsController = new TabsController();
|
|
@State leftSideBarFocusIndex: number = 0;
|
|
build() {
|
|
Row() {
|
|
Scroll() {
|
|
Flex({ direction: FlexDirection.Column }) {
|
|
ForEach(this.leftSideBarTabsName, (item: LeftSideTabName, index: number) => {
|
|
Column({ space: 5 }) {
|
|
Button(item.str)
|
|
.fontWeight(index === this.leftSideBarFocusIndex ? FontWeight.Bold : FontWeight.Normal)
|
|
.height(50)
|
|
.width(50)
|
|
.padding(5)
|
|
.type(ButtonType.Normal)
|
|
}
|
|
.padding({ left: 5, right: 5 })
|
|
.margin({ top: 2,left:2,bottom:2,right:2})
|
|
.onClick(() => {
|
|
this.leftSideBarTabs.changeIndex(index);
|
|
this.leftSideBarFocusIndex = index;
|
|
})
|
|
})
|
|
Blank().height('80%')
|
|
}
|
|
}
|
|
.align(Alignment.Start)
|
|
.scrollable(ScrollDirection.Vertical)
|
|
.scrollBar(BarState.Off)
|
|
.width('30%')
|
|
|
|
Tabs({ barPosition: BarPosition.Start, controller: this.leftSideBarTabs }) {
|
|
ForEach(this.leftSideBarTabsName, (item: LeftSideTabName, index: number) => {
|
|
TabContent() {
|
|
Text(item.str)
|
|
.fontSize(30)
|
|
}
|
|
})
|
|
}.barHeight(0)
|
|
.width('70%')
|
|
}.borderWidth('1')
|
|
}
|
|
} |