# ProgressHUD **Repository Path**: CoderXLL/progress-hud ## Basic Information - **Project Name**: ProgressHUD - **Description**: hud是一个非常好用的鸿蒙Loading和Toast组件,相对于系统组件更加的美观且可以高度自定制 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2024-03-14 - **Last Updated**: 2024-03-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # hud ## 说明 > - hud是一个非常好用的鸿蒙Loading和Toast组件,相对于系统组件更加的美观且可以高度自定制。 > > > - 本人主要从事iOS开发,故该组件目前包括未来版本中API的命名和调用方式 都会向着iOS主流hud库看齐。 > > > - 注意点:加载框会阻挡业务页面上的按钮操作,Toast提示不会遮挡,符合业务需求。 ![showhud](./screenshot/showhud.gif) ## 安裝与使用 - 安装 ``` ohpm install @xll/hud ``` - 使用 ``` /** 导入 */ import { HUD, HUDMgr, HUDType } from '@xll/hud'; @State hudMgr: HUDMgr = new HUDMgr(false, HUDType.None) build() { Stack() { Column({ space: 10 }) { Button('显示加载') .onClick(() => { this.hudMgr.showLoading('正在加载') // 模拟网络请求成功,隐藏加载框 setTimeout(() => { this.hudMgr.hide() }, 2000) }) Button('成功toast') .onClick(() => { this.hudMgr.showSuccess('加载成功') }) Button('失败toast') .onClick(() => { this.hudMgr.showError('加载失败') }) Button('纯toast') .onClick(() => { this.hudMgr.showInfo('你是个坏淫') }) } .width('100%') HUD({ hudMgr: this.hudMgr }) } } ``` ## 接口说明 | 使用方法 | 参数类型 | 相关描述 | |-----------------------|------------------------|-------------| | showLoading() | text? | 弹出加载框 | | showSuccess() | text? | 成功toast | | showError() | text? | 失败toast | | showInfo() | text | 纯toast | | hide() | void | 隐藏toast或加载框 | ## 约束与限制 在下述版本验证通过: - DevEco Studio: 4.1 Canary(4.1.3.600), SDK: API11, Node: 18.14.1 ## 开放声明与代码贡献 - 为了向您提供最新的服务,我会不时更新hud版本。我们强烈建议开发者集成使用最新版本的hud。 - 使用过程中发现任何问题都可以提 [Issue](https://gitee.com/CoderXLL/progress-hud/issues) 给我,当然,我也非常期待你给我发 [PR](https://gitee.com/CoderXLL/progress-hud/pulls) 。 ## 开源协议 本项目基于 [MIT License](https://gitee.com/CoderXLL/progress-hud/blob/main/LICENSE) ,请自由地享受和参与开源。