From 1edda80d21ddf824f64a0881692eafed9f88979f Mon Sep 17 00:00:00 2001 From: ZF sun <34314687@qq.com> Date: Fri, 29 May 2026 14:35:52 +0800 Subject: [PATCH] =?UTF-8?q?fix(merch/detail):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=A4=B4=E9=83=A8=E9=AB=98=E5=BA=A6=E9=87=8D=E5=A4=8D=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加headerHeightInited标记,避免merch数据更新时重复调用初始化方法 --- pages_promotion/merch/detail.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pages_promotion/merch/detail.vue b/pages_promotion/merch/detail.vue index c3be433..a263376 100644 --- a/pages_promotion/merch/detail.vue +++ b/pages_promotion/merch/detail.vue @@ -321,16 +321,19 @@ export default { data() { return { headerHeight: 320, - screenWidth: uni.getSystemInfoSync().windowWidth + screenWidth: uni.getSystemInfoSync().windowWidth, + headerHeightInited: false }; }, mixins: [list], watch: { merch: { handler() { - this.$nextTick(() => { - this.initHeaderHeight(); - }); + if (!this.headerHeightInited) { + this.$nextTick(() => { + this.initHeaderHeight(); + }); + } }, deep: true } @@ -349,8 +352,9 @@ export default { setTimeout(() => { const query = uni.createSelectorQuery().in(this); query.select('.head-wrap').boundingClientRect(rect => { - if (rect) { + if (rect && rect.height > 0) { this.headerHeight = (rect.height / this.screenWidth) * 750; + this.headerHeightInited = true; } }).exec(); }, 100);