fix(harmony): 修鸿蒙元服务 JSVM 兼容性

基于 .logs/harmony-debug.log 排查,修复 3 类 runtime 错误:

1. isWeChatMiniProgram / cashier autoPay / ai-chat 复制文本
   - 鸿蒙 JSVM 没有 navigator 全局, navigator.userAgent 直接 ReferenceError
   - 加 typeof navigator === 'undefined' 守卫,Harmony 上返回 false,
     业务落到 isWeiXin()(已被 #ifdef H5 框住,Harmony 上也 false)→ 普通登录

2. diy-category getHeightArea
   - onShow 在 mounted 前触发,query 还是 undefined
   - query 重新尝试创建;createSelectorQuery 不存在则直接 return
   - 防止首次进入崩溃

3. goods-detail-view 模板 indexOf
   - goodsSkuDetail.support_trade_type 字段偶尔缺失
   - 改 (support_trade_type || []).indexOf(...) 兜底
This commit is contained in:
2026-07-04 11:26:47 +08:00
parent c9c062edcb
commit 6617a0b36c
5 changed files with 18 additions and 4 deletions

View File

@@ -65,7 +65,7 @@
<view class="box">
<block v-for="(item, index) in deliveryType" :key="index">
<text
v-if="goodsSkuDetail.support_trade_type.indexOf(index) != -1">{{ $lang('goods.detail.express') }}</text>
v-if="(goodsSkuDetail.support_trade_type || []).indexOf(index) != -1">{{ $lang('goods.detail.express') }}</text>
<!-- {{ item.name }} -->
</block>
</view>
@@ -159,7 +159,7 @@
<scroll-view scroll-y class="type-body">
<block v-for="(item, index) in deliveryType" :key="index">
<view class="type-item"
:class="{ 'not-support': goodsSkuDetail.support_trade_type.indexOf(index) == -1 }">
:class="{ 'not-support': (goodsSkuDetail.support_trade_type || []).indexOf(index) == -1 }">
<text class="iconfont" :class="item.icon"></text>
<view class="content">
<view class="title">{{ item.name }}</view>