|
|
|
@ -339,8 +339,8 @@ export default {
|
|
|
|
this.moveY = e.touches[0].pageY;
|
|
|
|
this.moveY = e.touches[0].pageY;
|
|
|
|
const moveDistance = this.moveY - this.startY;
|
|
|
|
const moveDistance = this.moveY - this.startY;
|
|
|
|
|
|
|
|
|
|
|
|
// 只有向下移动(moveDistance > 0)时才触发下拉效果
|
|
|
|
// 只有向下移动(moveDistance > 0)且移动距离合理时才触发下拉效果
|
|
|
|
if (moveDistance > 0) {
|
|
|
|
if (moveDistance > 0 && moveDistance < 200) { // 限制最大下拉距离
|
|
|
|
const query = uni.createSelectorQuery().in(this);
|
|
|
|
const query = uni.createSelectorQuery().in(this);
|
|
|
|
query.select('.scroll-container').boundingClientRect(data => {
|
|
|
|
query.select('.scroll-container').boundingClientRect(data => {
|
|
|
|
if (data) {
|
|
|
|
if (data) {
|
|
|
|
@ -348,10 +348,8 @@ export default {
|
|
|
|
// 只有在滚动到顶部且向下拉动时才执行缩放
|
|
|
|
// 只有在滚动到顶部且向下拉动时才执行缩放
|
|
|
|
if (scrollTop <= 0) {
|
|
|
|
if (scrollTop <= 0) {
|
|
|
|
// 根据移动距离计算缩放值,使效果更自然
|
|
|
|
// 根据移动距离计算缩放值,使效果更自然
|
|
|
|
// 可以调整 divisor(这里是80)来改变缩放的灵敏度
|
|
|
|
this.backgroundScale = Math.min(moveDistance * 0.05, 10); // 限制最大缩放值
|
|
|
|
const scaleValue = Math.min(moveDistance / 40, 1); // 限制最大缩放值
|
|
|
|
this.mtScroll = Math.min(moveDistance * 0.05, 10);
|
|
|
|
this.backgroundScale = scaleValue;
|
|
|
|
|
|
|
|
this.mtScroll = scaleValue;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).exec();
|
|
|
|
}).exec();
|
|
|
|
|