import { WindowHelper } from '../utils/WindowHelper' import { inputMethod } from '@kit.IMEKit' @Preview @Component export struct SafeView { @Consume('pageInfos') pageInfos?: NavPathStack @Link isLoading: boolean @State _titleText: ResourceStr='' private _onBackEvent?: () => void @Builder doNothingBuilder() { } onBack(event: () => void) { this._onBackEvent = event return this } titleText(title: ResourceStr) { this._titleText = title return this } @BuilderParam customBuilderParam: () => void = this.doNothingBuilder build() { NavDestination() { Stack() { Column() { Row() .height(WindowHelper.topRectHeight) .width('100%') .backgroundColor('#999999') Row() { Image($r("app.media.base_back")) .height(15) .onClick(() => { if (this._onBackEvent) { this._onBackEvent() } else if (this.pageInfos) { this.pageInfos.pop() } }) Text(this._titleText ?? '') .maxLines(1) .ellipsisMode(EllipsisMode.CENTER) .textOverflow({ overflow: TextOverflow.Ellipsis }) Row() { } } .justifyContent(FlexAlign.SpaceBetween) .padding({ left: 15, right: 15 }) .height(44) .width('100%') this.customBuilderParam() } .width('100%') .height('100%') .justifyContent(FlexAlign.Start) Column() { LoadingProgress() .color(Color.White) .width(80).height(80) Text('努力加载中..') .fontSize(16) .fontColor(Color.White) } .visibility(this.isLoading ? Visibility.Visible : Visibility.None) .width('100%') .height('100%') .backgroundColor('#40000000') .justifyContent(FlexAlign.Center) } }.onClick(() => { inputMethod.getController().stopInputSession() }) .hideTitleBar(true) .width('100%') .height('100%') } }