Skip to content

Commit

Permalink
fix(test): swiper spec
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryCode committed Nov 6, 2020
1 parent 2398793 commit 8bea560
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/taro-components/__tests__/swiper.spec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './polyfill'
import React from 'react'
import * as assert from 'assert'
import * as sinon from 'sinon'
Expand Down
9 changes: 2 additions & 7 deletions packages/taro-components/src/components/swiper/swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ let INSTANCE_ID = 0
})
export class Swiper implements ComponentInterface {
private _id = INSTANCE_ID++
private swiper

@Element() el: HTMLElement
@State() swiperWrapper: HTMLElement | null
@State() private swiper: SwiperJS
/**
* 是否显示面板指示点
*/
Expand Down Expand Up @@ -97,7 +97,7 @@ export class Swiper implements ComponentInterface {
if (isNaN(n)) return

if (this.circular) {
const interval = this.swiper.isBeginning || this.swiper.isBeginning ? this.interval : 0
const interval = this.swiper.isBeginning || this.swiper.isEnd ? 0 : this.interval
this.swiper.slideToLoop(n, interval) // 更新下标
} else {
this.swiper.slideTo(n) // 更新下标
Expand Down Expand Up @@ -219,11 +219,6 @@ export class Swiper implements ComponentInterface {
this.swiper.update() // 更新子元素
}

disconnectedCallback () {
this.swiperWrapper = null
this.swiper.destroy()
}

render () {
const {
vertical,
Expand Down

0 comments on commit 8bea560

Please sign in to comment.