Skip to content

Commit

Permalink
fix: swiper init error #6674
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakaryCode committed Jun 15, 2020
1 parent db8b5fb commit 74419cd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/taro-components/src/components/swiper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ class Swiper extends Nerv.Component {
}
}

componentDidUpdate () {
componentDidUpdate (preProps) {
if (preProps.children.length === 0 && this.props.children.length > 0) {
this.mySwiper.loopDestroy()
this.mySwiper.loopCreate()
}
if (!this.mySwiper) return
if (this.props.autoplay) {
if (this._$width !== this.mySwiper.width || this._$height !== this.mySwiper.height) {
Expand Down

0 comments on commit 74419cd

Please sign in to comment.