diff --git a/common/js/util.js b/common/js/util.js
index e0083dd..587887a 100644
--- a/common/js/util.js
+++ b/common/js/util.js
@@ -996,8 +996,11 @@ export default {
/**
* 判断是否在微信小程序的web-view中打开H5
* @returns {boolean} 是否在微信小程序的web-view中
+ *
+ * 鸿蒙元服务(JSVM)没有 navigator 全局,改用 typeof 守卫兜底,让它直接返回 false
*/
isWeChatMiniProgram() {
+ if (typeof navigator === 'undefined' || !navigator.userAgent) return false;
const userAgent = navigator.userAgent.toLowerCase();
// 微信小程序的web-view User-Agent会包含以下特征之一
diff --git a/components-diy/diy-category.vue b/components-diy/diy-category.vue
index 29c3555..8ef0406 100644
--- a/components-diy/diy-category.vue
+++ b/components-diy/diy-category.vue
@@ -301,9 +301,20 @@ export default {
},
/**
* 获取高度区间
+ *
+ * 鸿蒙 JSVM 在 mounted() 之前触发 onShow,导致 query 还是 undefined
+ * 加防御性检查,避免上线后第一次进入崩溃
*/
getHeightArea(index) {
let heightArea = [];
+ if (!query || typeof query.selectAll !== 'function') {
+ query = uni.createSelectorQuery && uni.createSelectorQuery().in(this);
+ }
+ if (!query || typeof query.selectAll !== 'function') {
+ // 极端兜底:鸿蒙下若 createSelectorQuery 不存在,跳过计算
+ this.heightArea = heightArea;
+ return;
+ }
query
.selectAll('.content-wrap .child-category')
.boundingClientRect(data => {
diff --git a/pages_goods/_components/goods-detail-view/goods-detail-view.vue b/pages_goods/_components/goods-detail-view/goods-detail-view.vue
index 0b18b0c..da84a7b 100644
--- a/pages_goods/_components/goods-detail-view/goods-detail-view.vue
+++ b/pages_goods/_components/goods-detail-view/goods-detail-view.vue
@@ -65,7 +65,7 @@
{{ $lang('goods.detail.express') }}
+ v-if="(goodsSkuDetail.support_trade_type || []).indexOf(index) != -1">{{ $lang('goods.detail.express') }}
@@ -159,7 +159,7 @@
+ :class="{ 'not-support': (goodsSkuDetail.support_trade_type || []).indexOf(index) == -1 }">
{{ item.name }}
diff --git a/pages_tool/ai-chat/ai-chat-message.vue b/pages_tool/ai-chat/ai-chat-message.vue
index b0fe5a8..8ed8f5f 100644
--- a/pages_tool/ai-chat/ai-chat-message.vue
+++ b/pages_tool/ai-chat/ai-chat-message.vue
@@ -1686,7 +1686,7 @@ _handleStreamError(msg) {
// H5 优先使用 Clipboard API,降级使用 document.execCommand
try {
- if (navigator.clipboard && navigator.clipboard.writeText) {
+ if (typeof navigator !== 'undefined' && navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(finalText).then(() => {
uni.showToast({ title: selectedText ? this.$lang('ai-chat.index.copySelected') : this.$lang('ai-chat.index.copySuccess'), icon: 'success' })
}).catch(() => {
diff --git a/pages_tool/pay/cashier.vue b/pages_tool/pay/cashier.vue
index c5ff6a8..c9a2eff 100644
--- a/pages_tool/pay/cashier.vue
+++ b/pages_tool/pay/cashier.vue
@@ -116,7 +116,7 @@ export default {
this.confirm();
}
})
- } else if (/AlipayClient/.test(window.navigator.userAgent)) {
+ } else if (typeof window !== 'undefined' && window.navigator && /AlipayClient/.test(window.navigator.userAgent || '')) {
this.payTypeList.forEach((item, index) => {
if (item.type == 'alipay') {
this.payIndex = index;