华为鸿蒙项目(api11) 具体包含功能如下:
1、网络请求的基础封装(基于axios);
基于 @ohos/axios 实现了网络拦截器,网络解析等功能,封装项目页面多状态(加载中,成功,失败,空数据);

2、全局loading实现
原生的 toast 并不好用,通过添加子窗口的形式,通过事件线或者直接调用
javascript
/**
* 通过创建子窗口来显示Loading弹窗
*/
static createLoadingWindow(stage: window.WindowStage) {
stage?.createSubWindow('loading_window').then(async win => {
// 设置子窗口显示的页面
await win.setUIContent('pages/LoadingPage')
let d = display.getDefaultDisplaySync()
let windowClass = stage.getMainWindowSync()
let area = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM);
// 调整子窗口大小,需剔除状态栏和导航栏高度,否则显示内容不居中
await win.resize(d.width, d.height - area.topRect.height - area.bottomRect.height)
// 设置半透明效果
win.setWindowBackgroundColor('#00000000')
})
}
/**
* 销毁子窗口来
*/
static async destroyLoadingWindow() {
let windowClass: window.Window | undefined = undefined;
try {
windowClass = window.findWindow('loading_window');
await windowClass.destroyWindow()
} catch (_) {
}
}
/**
* 显示loading子窗口
* @param stage stage
*/
static async showLoadingWindow() {
let windowClass: window.Window | undefined = undefined;
try {
windowClass = window.findWindow('loading_window');
await windowClass.showWindow()
} catch (exception) {
}
}
/**
* 关闭loading子窗口
* @param stage stage
*/
static async closeLoadingWindow() {
let windowClass: window.Window | undefined = undefined;
try {
windowClass = window.findWindow('loading_window');
await windowClass.minimize();
} catch (_) {
}
}
3、存储工具/权限工具/json,视频播放器封装工具等

4、日历封装可以左右切换/上下切换

具体实现可见 github.com/lijiee/harm...
通过 flutter 鸿蒙分支的 flutter 鸿蒙化地址 github.com/lijiee/flut...