We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
抄colorui的垂直导航时踩坑了,明明完全一样的代码,为何colorui上下滚动时左侧tab会跟着变,而我上下滚动时左侧tab不动???
代码如下:
VerticalMain(e) { let that = this; let list = this.data.list; let tabHeight = 0; if (this.data.load) { for (let i = 0; i < list.length; i++) { let view = wx.createSelectorQuery().select("#main-" + list[i].id); view.fields({ size: true }, data => { list[i].top = tabHeight; tabHeight = tabHeight + data.height; list[i].bottom = tabHeight; }).exec(); } that.setData({ load: false, list: list }) } let scrollTop = e.detail.scrollTop + 20; for (let i = 0; i < list.length; i++) { if (scrollTop > list[i].top && scrollTop < list[i].bottom) { that.setData({ VerticalNavTop: (list[i].id - 1) * 50, TabCur: list[i].id }) return false } } }
我打印输出 view.fields 的回调参数 data 时发现为 null,这特么让我震惊了!!!看官方论坛发现有人说是id不能为数字的原因,我立马否决这个答案,因为colorui一点问题没有!
view.fields
data
后来洗了把澡,清醒了些,意识到我的页面是 Component,而 colorui 对应的是 Page,我怀疑是这里有问题,遂去官方文档上找,果然!!!
看 wx.createSelectorQuery() 说明,开头就是提醒!!!
抄人家的代码不是那么简单的啊,一不小心就踩坑了。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
抄colorui的垂直导航时踩坑了,明明完全一样的代码,为何colorui上下滚动时左侧tab会跟着变,而我上下滚动时左侧tab不动???
代码如下:
我打印输出
view.fields
的回调参数data
时发现为 null,这特么让我震惊了!!!看官方论坛发现有人说是id不能为数字的原因,我立马否决这个答案,因为colorui一点问题没有!后来洗了把澡,清醒了些,意识到我的页面是 Component,而 colorui 对应的是 Page,我怀疑是这里有问题,遂去官方文档上找,果然!!!
看 wx.createSelectorQuery() 说明,开头就是提醒!!!
抄人家的代码不是那么简单的啊,一不小心就踩坑了。
The text was updated successfully, but these errors were encountered: