Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于左右联动的问题 #4

Open
knyel opened this issue Jul 16, 2018 · 2 comments
Open

关于左右联动的问题 #4

knyel opened this issue Jul 16, 2018 · 2 comments

Comments

@knyel
Copy link

knyel commented Jul 16, 2018

我通过如下方式,虽然实现了左右联动,但是不知道为什么反应特别的慢,请问您知道原因吗

methods: {
scroll (e) {
let scrollTop = e.mp.detail.scrollTop
this.currentY = Math.abs(Math.round(scrollTop))
}
},
computed: {
currentIndex () {
for (let i = 0; i < this.foodListHeights.length - 1; i++) {
let heightBottom = this.foodListHeights[i]
let heightTop = this.foodListHeights[i + 1]
// 对滑动后currentY值不足的情况进行修正
let diff = Math.abs(this.currentY - heightTop)
if (diff < 5) {
this.currentY = heightTop
}
// 判断currentY当前所在的区间
if (this.currentY < heightTop && this.currentY >= heightBottom) {
return i
}
}
}
}

@xjonson
Copy link

xjonson commented Aug 1, 2018

我也碰到了,安卓下反应很慢,ios下好点,还没解决

@hubei207
Copy link

我也碰到这个问题,找不到原因。
//右边内容区域滚动
onScroll(e) {
this.contentId = "";
let scrollTop = e.target.scrollTop;
let domListHeight = this.listHeight;
if (scrollTop >= domListHeight[domListHeight.length - 1] - this.contentHeight) {
return;
} else if(scrollTop > 0 && scrollTop < domListHeight[0]){
this.currentIndex = 0;
}
for (let i = 0; i < domListHeight.length; i++) {
if(scrollTop >= domListHeight[i - 1] && scrollTop < domListHeight[i]) {
this.currentIndex = i;
}
}
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants