Skip to content

Commit

Permalink
fix: swiper组件style传入问题
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhuo committed Jul 24, 2024
1 parent c5be5d2 commit ff9c509
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/vantui/src/swiper/demo/demo1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default function Demo() {
autoPlay="3000"
initPage={initPage1}
paginationVisible
style={{ borderRadius: 12 }}
>
{images.map((item, index) => (
<SwiperItem key={`swiper#demo1${index}`}>
Expand Down
7 changes: 4 additions & 3 deletions packages/vantui/src/swiper/swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -375,15 +375,16 @@ const Swiper = (
}, [size, childCount])

const containerStyle = useMemo(() => {
const style = {
const _style = {
width: W || '100%',
height: H || '100%',
...style,
}
if (containerSize) {
style[isVertical ? 'height' : 'width'] = containerSize
_style[isVertical ? 'height' : 'width'] = containerSize
}

return style
return _style
}, [H, W, containerSize, isVertical])

return (
Expand Down

0 comments on commit ff9c509

Please sign in to comment.