老师请看
来源:6-11 优化加载提示,状态展示组件
慕先生4062878
2021-06-26
生成骨架之后这个左右滑动没有效果,然后点击swiper的时候得下拉刷新才能出来
2回答
-
沁尘
2021-06-26
1. 滑动不生效是因为 tabs.js 里第 33 行这里的判断逻辑写错了,这里永远只会是 true。
const index = event.currentTarget.dataset.index;
//判断:如果当前选中的下标位置等于获取到的下表,ze直接return
if (index === event.currentTarget.dataset.index) { // 正确应该是:index === this.data.currentTabIndex
return
}
2. swiper 的问题是 home.js 的`handleCategoryChange` 函数里代码执行顺序问题,应该是先判断,再赋值,不然判断条件只会是 true。
// 原来的代码
handleCategoryChange: throttle(function (event) {
this.data.categoryId = event.currentTarget.dataset.id;
//判断当前分类ID否否等于传递过来的ID
if (this.data.categoryId === event.currentTarget.dataset.id){
return
}
this._getServiceList();
}),
// 正确的代码
handleCategoryChange: throttle(function (event) {
//判断当前分类ID否否等于传递过来的ID
if (this.data.categoryId === event.currentTarget.dataset.id){
return
}
this.data.categoryId = event.currentTarget.dataset.id;
this._getServiceList();
}),
022021-06-26 -
沁尘
2021-06-26
同学你好,提供下“代码片段(点我)”,看截图定位不了问题
022021-06-26
相似问题