fix(Swipe): incorrect swipeTo animation (#4570)

This commit is contained in:
neverland 2019-09-25 15:11:23 +08:00 committed by GitHub
parent 0fe9874379
commit a70c0ac5f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -254,8 +254,15 @@ export default createComponent({
this.correctPosition();
doubleRaf(() => {
let targetIndex;
if (this.loop && index === this.count) {
targetIndex = this.active === 0 ? 0 : index;
} else {
targetIndex = index % this.count;
}
this.move({
pace: (index % this.count) - this.active,
pace: targetIndex - this.active,
emitChange: true
});