Skip to content

Commit

Permalink
fix: swiper垂直方向bug
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and [email protected] committed Nov 1, 2022
1 parent 3a1a185 commit 5235c47
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/vantui/src/swiper/swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -435,15 +435,11 @@ const Swiper = (
}, [isVertical, width, height, offset, ready])

useEffect(() => {
if (ready) {
stopAutoPlay()
autoplay()
}
return () => {
setReady(false)
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [ready])
}, [])

useEffect(() => {
stopAutoPlay()
Expand All @@ -463,9 +459,11 @@ const Swiper = (
}, [])

useReady(() => {
init()
Taro.nextTick(() => {
setTimeout(() => {
init()
stopAutoPlay()
autoplay()
}, 16)
})
})
Expand All @@ -478,6 +476,7 @@ const Swiper = (
style[_direction === 'horizontal' ? 'width' : 'height'] = `${_size}px`
}
const offset = childOffset[index]

if (offset) {
style.transform = `translate3D${
_direction === 'horizontal' ? `(${offset}px,0,0)` : `(0,${offset}px,0)`
Expand Down

0 comments on commit 5235c47

Please sign in to comment.