import { mwInfo } from "../AppStorageV2Class"; import { ExecuteCommand } from "../EventSubWindow/ExecuteCommand"; import { TitleButton } from "../LayoutInterface/Interface/ButtonInterface"; import {SwitchView} from "../LayoutInterface/Layout/SwitchView" //按钮统一尺寸,该按钮为正方形,所以以主窗口宽为基准,长=高->正方形 let ebWidth=mwInfo.mWinWidth*0.02; let ebHeigth=mwInfo.mWinWidth*0.02; //视图切换弹窗 @CustomDialog export struct ViewDialog { controller: CustomDialogController; build(){ Row({ space:2 }) { GridRow({ columns: 3 ,gutter: 5 }) { ForEach(SwitchView, (item: TitleButton, index?: number | undefined) => { GridCol({ span: 1 }) { Row() { Button() .backgroundColor(Color.Transparent) .backgroundImage($r('app.media.' + item.eIcon)) .backgroundImageSize({ width: '100%', // 图片宽度占满按钮 height: '100%' // 图片高度占满按钮 }).width(ebWidth).height(ebWidth) .onClick(()=>{ ExecuteCommand(item); }) } } }) } }.margin({ top: 5, left: 1, bottom: 1, right: 1 }) } }