# harmonyStatus **Repository Path**: ChuckHai/harmony-status ## Basic Information - **Project Name**: harmonyStatus - **Description**: harmonyStatus:内含页面状态机管理。loading、错误页面,无内容等页面状态可自由切换。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 5 - **Forks**: 1 - **Created**: 2024-04-23 - **Last Updated**: 2025-07-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Status status:内含页面状态机管理。loading、错误页面,无内容等页面状态可自由切换。 ## 开发环境 DevEco Studio NEXT Developer Beta1,Build Version: 5.0.3.403 Api版本:11 ## 安装 ``` ohpm install @chuck/status ``` ## 支持的功能点 - loading、错误页面,无内容等页面状态可自由切换 - 支持全局状态的Builder设置 - 支持页面自定义状态Builder设置 ## 效果展示 | 默认效果 | 自定义效果 | | ---------------------- | ----------------------- | | ![](image/default.gif) | ![](image/customer.gif) | ## 使用 **StatusComponent说明** | 字段 | 类型 | 介绍 | | -------------------- | --------------------------- | --------------------------------- | | contentBuilder | @BuilderParam **(@Require)** | 内容布局 | | pageStatus | **PageStatus** | page状态 | | loadingStatusBuilder | @BuilderParam | 自定义loading Builder | | noContentBuilder | @BuilderParam | 自定义无内容Builder | | errorStatusBuilder | @BuilderParam | 自定义错误状态Builder | | errorEvent | Function | 全局状态下的error Builder点击回调 | **全局设置** ```typescript StatusManager.getInstance() .setLoadingWrapBuilder(wrapBuilder(globalLoadingStatus)) .setNoContentWrapBuilder(wrapBuilder(globalNoContentStatus)) .setErrorWrapBuilder(wrapBuilder(globalErrorStatus)) //tips: wrapBuilder只能传入全局@Builder方法 ``` **自定义设置** ```typescript StatusComponent({ pageStatus: this.pageStatus, contentBuilder: () => { this.listBuilder() }, loadingStatusBuilder: this.loadingStatusBuilder, noContentBuilder: this.noContentStatusBuilder, errorStatusBuilder: this.errorStatusBuilder, } //tips 实现StatusComponent组件内的loadingStatusBuilder、noContentBuilder、errorStatusBuilder即可 ``` ## License ``` Copyright (C) Chuck, HarmonyOsStatus Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ```