提交 bfb09725 编写于 作者: H hdx

long-list: 撤回 Math.floor 导致的线跳动问题

上级 1a03fa54
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
// 计算当前索引并重置差异 // 计算当前索引并重置差异
const current_offset_x = offset_x % this.$swiperWidth const current_offset_x = offset_x % this.$swiperWidth
const current_offset_i = offset_x / this.$swiperWidth const current_offset_i = offset_x / this.$swiperWidth
const current_index = this.$animationFinishIndex + Math.floor(current_offset_i) const current_index = this.$animationFinishIndex + parseInt(current_offset_i + '')
// 计算目标索引及边界检查 // 计算目标索引及边界检查
let move_to_index = current_index let move_to_index = current_index
...@@ -170,6 +170,7 @@ ...@@ -170,6 +170,7 @@
onSwiperAnimationfinish(e : SwiperAnimationFinishEvent) { onSwiperAnimationfinish(e : SwiperAnimationFinishEvent) {
this.setSwiperIndex(e.detail.current, true) this.setSwiperIndex(e.detail.current, true)
this.$animationFinishIndex = e.detail.current this.$animationFinishIndex = e.detail.current
console.log('this.$animationFinishIndex', e.detail.current);
}, },
cacheTabItemsSize() { cacheTabItemsSize() {
this.$swiperTabsRect.length = 0 this.$swiperTabsRect.length = 0
......
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
// 计算当前索引并重置差异 // 计算当前索引并重置差异
const current_offset_x = offset_x % this.$swiperWidth const current_offset_x = offset_x % this.$swiperWidth
const current_offset_i = offset_x / this.$swiperWidth const current_offset_i = offset_x / this.$swiperWidth
const current_index = this.$animationFinishIndex + Math.floor(current_offset_i) const current_index = this.$animationFinishIndex + parseInt(current_offset_i + '')
// 计算目标索引及边界检查 // 计算目标索引及边界检查
let move_to_index = current_index let move_to_index = current_index
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册