From c56b8e383f0d9da3ad3658087c37f9826da8ceeb Mon Sep 17 00:00:00 2001 From: jscyl13849007907 <13849007907@163.com> Date: Mon, 4 Aug 2025 13:46:08 +0800 Subject: [PATCH] no message --- root/detail/userShare.vue | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/root/detail/userShare.vue b/root/detail/userShare.vue index de009d5..74bd5dc 100644 --- a/root/detail/userShare.vue +++ b/root/detail/userShare.vue @@ -7,11 +7,12 @@ :background="background" :backIconName="fromShare ? 'home' : 'arrow-left'" > + 0) { this.moveY = e.touches[0].pageY; - const query = uni.createSelectorQuery().in(this); - query.select('.scroll-container').boundingClientRect(data => { - if (data) { - const scrollTop = data.scrollTop || 0; - if (scrollTop <= 0 && this.moveY > this.startY) { - const pullDistance = this.moveY - this.startY; - this.backgroundScale++; - this.mtScroll++; + const moveDistance = this.moveY - this.startY; + + // 只有向下移动(moveDistance > 0)时才触发下拉效果 + if (moveDistance > 0) { + const query = uni.createSelectorQuery().in(this); + query.select('.scroll-container').boundingClientRect(data => { + if (data) { + const scrollTop = data.scrollTop || 0; + // 只有在滚动到顶部且向下拉动时才执行缩放 + if (scrollTop <= 0) { + // 根据移动距离计算缩放值,使效果更自然 + // 可以调整 divisor(这里是80)来改变缩放的灵敏度 + const scaleValue = Math.min(moveDistance / 40, 5); // 限制最大缩放值 + this.backgroundScale = scaleValue; + this.mtScroll = scaleValue; + } } - } - }).exec(); + }).exec(); + } } },