70 lines
2.4 KiB
Plaintext
70 lines
2.4 KiB
Plaintext
import { hilog } from '@kit.PerformanceAnalysisKit';
|
|
import { MainWindowInfo } from './AppStorageV2Class';
|
|
import {ModelView} from './modelView'
|
|
import { AppStorageV2 } from '@kit.ArkUI';
|
|
|
|
class TaskTab{
|
|
icon:string=''
|
|
str:string='default model'
|
|
event:string=''
|
|
}
|
|
let dTab:Array<TaskTab>=[
|
|
{icon:'',str:'默认任务',event:''}
|
|
]
|
|
|
|
@ComponentV2
|
|
export struct ModelViewTab {
|
|
@Local mwInfo: MainWindowInfo = AppStorageV2.connect<MainWindowInfo>(MainWindowInfo, () => new MainWindowInfo())!;
|
|
|
|
//顶部导航组件
|
|
private modelViewBarTabs: TabsController = new TabsController();
|
|
//当前的顶部导航选择页
|
|
@Local modelViewBarFocusIndex: number = 0;
|
|
@Local modelFilePath:string='';
|
|
build() {
|
|
Flex({ direction: FlexDirection.Column }) {
|
|
Scroll() {
|
|
Row() {
|
|
ForEach(dTab, (item: TaskTab, index: number) => {
|
|
Row({ space: 0 }) {
|
|
Image($r('app.media.startIcon'))
|
|
.width(this.mwInfo.mainWindowWidth*0.012)
|
|
.height(this.mwInfo.mainWindowWidth*0.012)
|
|
.objectFit(ImageFit.Contain)
|
|
Button(item.str)
|
|
.fontWeight(index === this.modelViewBarFocusIndex ? FontWeight.Bold : FontWeight.Normal)
|
|
.width('auto')
|
|
.height(this.mwInfo.mainWindowWidth*0.012)
|
|
.type(ButtonType.Normal)
|
|
Button('X')
|
|
.fontSize(12)
|
|
.width(this.mwInfo.mainWindowWidth*0.012)
|
|
.height(this.mwInfo.mainWindowWidth*0.012)
|
|
.type(ButtonType.Normal)
|
|
.align(Alignment.Center)
|
|
}.onClick(() => {
|
|
this.modelViewBarTabs.changeIndex(index);
|
|
this.modelViewBarFocusIndex = index;
|
|
})
|
|
})
|
|
}
|
|
}.align(Alignment.Start)
|
|
.scrollable(ScrollDirection.Horizontal)
|
|
.scrollBar(BarState.Off)
|
|
.width('100%')
|
|
//分割线
|
|
Divider().vertical(false).strokeWidth(1).color(0x000000).lineCap(LineCapStyle.Round).width('100%').backgroundColor(Color.Gray)
|
|
Tabs({ barPosition: BarPosition.Start, index: 0, controller: this.modelViewBarTabs }) {
|
|
TabContent() {
|
|
ModelView()
|
|
}.align(Alignment.Start)
|
|
.padding(1)
|
|
}.scrollable(false)
|
|
.barHeight(0)
|
|
.height('auto')
|
|
.barMode(BarMode.Fixed)
|
|
}.borderWidth('1')
|
|
.height('auto')
|
|
}
|
|
}
|