html52.com
我爱小程序-开发者交流社区

微信小程序的swipe 在点击切换时,如果只有两个swipe-item,点击切换到方向不正常?

 三个swipe-item是正常的,两个的话我看wipe-item的transform没有动态改变,从第一个点击向右按钮切换到第二个,切换方向向右,,再点击回到第一个,切换方向是向左切换的,怎么能回到第一个时方向也向右?

两个按钮的点击事件

向前,向后按钮的点击事件,我是通过动态改变current参数的值  
prevClick() {
      const num = this.current > 0 ? this.current - 1 : this.option.length - 1;
      this.current = num;
    },
    nextCLick() {
      const num = this.current < this.option.length - 1 ? this.current + 1 : 0;
      this.current = num;
    },
有没有大神看下能不能有更好的方法?

.current = num;
    },
有没有大神看下能不能有更好的方法?

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付