2 Star 17 Fork 2

yuanbo li/loading_dialog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

LoadingDialog

介绍

简单易用的 Harmony LoadingDialog

安装教程

执行安装命令 ohpm install @lyb/loading-dialog

重要提醒

请勿在 EntryAbility.ets 文件中调用本库任何方法,不然会导致dialog显示不出来

  • 如果连续调用dialog,最好加上 await
  • 2.1.0 之后换了实现可以在任意地方调用
  • 支持加载、更新、关闭自定义视图

SDK Support

SDK版本 Support
2.0.0 + 5.0.0(12)
1.2.0 - 4.1.0(11)

默认样式预览

样式 预览效果
loading loading.png
success success.png
failure failure.png
info info.png
warn warn.png
toast toast.png
progress progress.png

使用说明

基础用法
  • 显示 loading LoadingDialog.showLoading('这是一个loading')
  • 显示 success LoadingDialog.showSuccess('这是一个success dialog')
  • 显示 failure LoadingDialog.showFailure('这是一个failure dialog')
  • 显示 info LoadingDialog.showInfo('这是一个info dialog')
  • 显示 progress LoadingDialog.showProgress('正在下载...', this.progress)
  • 隐藏 LoadingDialog.hide()
进阶用法
LoadingDialog.showLoading({
                msg: '这是一个loading',
                tintColor: Color.Red,
                textColor: Color.Yellow,
                ...
              })

全局参数定义

LoadingDialog.setGlobalSettings((setting) => {
      setting.tintColor = Color.White
      setting.textColor = Color.Orange
      ...
    })

自定义参数

参数 默认值 描述
msg "" 提示文本
alignment center 指示器位置
offset 0,0 指示器偏移量
tintColor 白色 指示器颜色(图片,progress等等)
textColor 白色 指示器文字颜色
hideDelay 2000ms 指示器自动关闭时间(loading,progress时无效)
fontSize 16 文字大小
backgroundColor #cc000000 指示器颜色
maskColor 透明 指示器蒙层的颜色
borderRadius 10 指示器圆角
transition undefined 指示器显示/关闭的转场
successSrc 成功图片 图片 (最好是svg格式)
failureSrc 失败图片 图片 (最好是svg格式)
infoSrc 提示图片 图片 (最好是svg格式)
warnSrc 警告图片 图片 (最好是svg格式)
hideOnTouchOutside false 点击dialog外是否隐藏
hideOnSystemBack false 系统侧滑返回时是否隐藏
isModal true 是否为模态窗口,模态窗口有蒙层,非模态窗口无蒙层

开源协议

MIT License

MIT License Copyright (c) 2024 yuanbo li Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

Harmony LoadingDialog 展开 收起
README
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/lyb5834/loading-dialog.git
git@gitee.com:lyb5834/loading-dialog.git
lyb5834
loading-dialog
loading_dialog
master

搜索帮助