Skip to content

Commit

Permalink
fix(components): 修复 swiper 组件 current 改变事件重复调用问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryCode committed Jan 6, 2021
1 parent 48fd285 commit e607cc9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/taro-components/src/components/swiper/swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,11 @@ export class Swiper implements ComponentInterface {
observer: true,
observeParents: true,
on: {
slideTo () {
that.current = this.realIndex
},
// slideChange 事件在 swiper.slideTo 改写 current 时不触发,因此用 slideChangeTransitionEnd 事件代替
slideChangeTransitionEnd () {
that.current = this.realIndex
that.onChange.emit({
current: this.realIndex,
source: ''
Expand Down

0 comments on commit e607cc9

Please sign in to comment.