基础布局
这个提交包含在:
父节点
348174c4c8
当前提交
82e14a060b
@ -43,6 +43,7 @@ export { WindowHelper } from './src/main/ets/utils/WindowHelper'
|
||||
* 自定义view
|
||||
*/
|
||||
export { LoadingView } from './src/main/ets/view/LoadingView'
|
||||
export { SafeView } from './src/main/ets/view/SafeView'
|
||||
/**
|
||||
* 自定义view
|
||||
*/
|
||||
|
||||
@ -1,30 +1,95 @@
|
||||
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() {
|
||||
Stack() {
|
||||
this.customBuilderParam()
|
||||
Column() {
|
||||
LoadingProgress()
|
||||
.color(Color.White)
|
||||
.width(80).height(80)
|
||||
Text('努力加载中..')
|
||||
.fontSize(16)
|
||||
.fontColor(Color.White)
|
||||
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)
|
||||
}
|
||||
.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%')
|
||||
}
|
||||
}
|
||||
二进制文件未显示。
|
之后 宽度: | 高度: | 大小: 274 B |
二进制文件未显示。
|
之后 宽度: | 高度: | 大小: 438 B |
二进制文件未显示。
|
之后 宽度: | 高度: | 大小: 536 B |
二进制文件未显示。
|
之后 宽度: | 高度: | 大小: 922 B |
二进制文件未显示。
|
之后 宽度: | 高度: | 大小: 1.0 KiB |
正在加载...
在新工单中引用
屏蔽一个用户