96SEO 2026-08-06 02:32 3
鸿蒙手机底部存在两种程序占用区域:

| 导航模式 | 程序区域 | 高度参考 |
|---|---|---|
| 全面屏手势导航手势横条~ px 三键虚拟导航Back / Home / Recent 键栏~ px 折叠屏 / 平板视具体型号不固定 | ||
如果 TabBar 高度写死为 56vp,手势条手机上图标会被遮住;输入框不处理键盘,键盘直接盖住输入框。两个问题,一套思路解决,
UIAbility onCreate ← 初始化路由、全局配置,还没有 Window
onWindowStageCreate ← Window 创建完成。这里拿 Window 对象
└─ loadContent ← 异步加载页面回调里安全区已稳定
onForeground ← 应用切到前台
onBackground ← 应用切到后台
onWindowStageDestroy ← Window 销毁
onDestroy ← Ability 销毁
唯一正确时机:onWindowStageCreate's loadContent 回调
onCreate: Window 还不存在调用 getMainWindow 会报错。loadContent: 回调触发时窗口内容已挂载。数据最终确定,
export function onWindowStageCreate: void {
windowStage.loadContent => {
if {
hilog.error);return,}
// ✅ 页面挂载完成后立即读取安全区,存入 AppStorage 供全局使用
const lastWindow = await windowStage.getMainWindow;其实,WindowUtil.init;}),}
鸿蒙提供 window.getWindowAvoidArea 接口。返回一个 AvoidArea 对象,包括 topRect / bottomRect / leftRect / rightRect,单位均为px,必须手动转成 vp。
import { window } from '@kit.ArkUI';export class WindowUtil {
private static readonly KEY_BOTTOM_OID = 'windowUtil_bottomAvoid';private static readonly KEY_STATUS_BAR = 'windowUtil_statusBar';static init: void {
try {
const systemArea = lastWindow.getWindowAvoidArea;const indicatorArea = lastWindow.getWindowAvoidArea;const statusBarHeight = px2vp;const navBarHeight = px2vp;const indicatorHeight = px2vp;AppStorage.setOrCreate;AppStorage.setOrCreate;} catch {
console.error);}
}
static getBottomAvoidHeight: number {
return AppStorage.get?
,;}
static getStatusBarHeight: number {
return AppStorage.get?,;}
}
为什么用 AppStorage 而不是全局变量?AppStorage 是鸿蒙框架管理的响应式存储。支持 @StorageProp 装饰器双向绑定,在多 Ability 场景下不会丢失数据。怎么说呢,
// ❌ barHeight 固定。手势条手机上 TabBar 内容被遮Tabs { ... } .barHeight
@ComponentV2 export struct HomePage {
@Local bottomAvoid: number = WindowUtil.getBottomAvoidHeight;
@Builder tabBarItem{ Column { Text .fontSize .fontColor Text .fontSize .fontColor }.width.height .padding // ✅ 图标视觉上出现在手势条上方 .justifyContent }
build{ Tabs{ TabContent{ HomeTabComp }.tabBar) TabContent{ ChatTabComp }.tabBar) TabContent{ ProfileTabComp }.tabBar) }.width.height .barHeight // ✅ barHeight=内容区+底部安全区 .divider .onChange=>{this.tabState.currentIndex=index});} }
从主要公式来看,
TabBar 总高度 = 内容区高度+ bottomAvoid TabBarItem 内容 padding-bottom = bottomAvoid.
| 属性 | 说明 |
|---|---|
| barPosition | { BarPosition.End } - 放底部 |
| barHeight | TabBar 总高度 |
| .tabBar | 自定义每个 Tab 样式 |
| onChange=>{}) | 切换 Tab 时触发事件;index 为当前激活索引 |
作为专业的SEO优化服务提供商,我们致力于通过科学、系统的搜索引擎优化策略,帮助企业在百度、Google等搜索引擎中获得更高的排名和流量。我们的服务涵盖网站结构优化、内容优化、技术SEO和链接建设等多个维度。
| 服务项目 | 基础套餐 | 标准套餐 | 高级定制 |
|---|---|---|---|
| 关键词优化数量 | 10-20个核心词 | 30-50个核心词+长尾词 | 80-150个全方位覆盖 |
| 内容优化 | 基础页面优化 | 全站内容优化+每月5篇原创 | 个性化内容策略+每月15篇原创 |
| 技术SEO | 基本技术检查 | 全面技术优化+移动适配 | 深度技术重构+性能优化 |
| 外链建设 | 每月5-10条 | 每月20-30条高质量外链 | 每月50+条多渠道外链 |
| 数据报告 | 月度基础报告 | 双周详细报告+分析 | 每周深度报告+策略调整 |
| 效果保障 | 3-6个月见效 | 2-4个月见效 | 1-3个月快速见效 |
我们的SEO优化服务遵循科学严谨的流程,确保每一步都基于数据分析和行业最佳实践:
全面检测网站技术问题、内容质量、竞争对手情况,制定个性化优化方案。
基于用户搜索意图和商业目标,制定全面的关键词矩阵和布局策略。
解决网站技术问题,优化网站结构,提升页面速度和移动端体验。
创作高质量原创内容,优化现有页面,建立内容更新机制。
获取高质量外部链接,建立品牌在线影响力,提升网站权威度。
持续监控排名、流量和转化数据,根据效果调整优化策略。
基于我们服务的客户数据统计,平均优化效果如下:
我们坚信,真正的SEO优化不仅仅是追求排名,而是通过提供优质内容、优化用户体验、建立网站权威,最终实现可持续的业务增长。我们的目标是与客户建立长期合作关系,共同成长。
Demand feedback