鸿蒙ArkTS/ArkUI电商实战-全局添加加载loading提示

鸿蒙ArkTS/ArkUI电商实战系列

本章内容

全局添加加载loading提示,线程间通信

效果图:


效果图

相关源码示例:

component目录下添加LoadingDialog.ets
LoadingDialog.ets

import hilog from '@ohos.hilog'

@CustomDialog
export struct LoadingDialog {
  @Prop loadingTips: string
  @State rotateAngle: number = 0
  //弹窗控制器
  controller: CustomDialogController
  private tag: string = 'LoadingDialog'

  aboutToAppear() {
    hilog.debug(0xFFFF, this.tag ,"Loading展示》》》》》")
  }

  build() {
    Stack() {
      Column() {
        Image($r('app.media.common_loading'))
          .height(50)
          .width(50)
          .rotate({angle: this.rotateAngle })
          .animation({
            duration: 500,
            iterations: -1,
            curve: Curve.Friction
          }).onAppear(() => {
          this.rotateAngle = 360
        })
        Text(this.loadingTips)
          .fontSize('15fp')
          .margin({ top: 10 })
      }
      .justifyContent(FlexAlign.Center)
      .height(150)
      .width(150)
      .backgroundColor(Color.White)
      .border({ radius: 5 })
    }
  }
}

event目录下创建EventKeys.etsLoadingDialogEvent.etsDialogUtils.ets文件
EventKeys.ets

还有 48% 的精彩内容
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
支付 ¥9.99 继续阅读