diff --git a/packages/vantui/src/swiper/demo/demo1.tsx b/packages/vantui/src/swiper/demo/demo1.tsx index 48ff06ca..b0073012 100644 --- a/packages/vantui/src/swiper/demo/demo1.tsx +++ b/packages/vantui/src/swiper/demo/demo1.tsx @@ -18,6 +18,7 @@ export default function Demo() { autoPlay="3000" initPage={initPage1} paginationVisible + style={{ borderRadius: 12 }} > {images.map((item, index) => ( diff --git a/packages/vantui/src/swiper/swiper.tsx b/packages/vantui/src/swiper/swiper.tsx index 7bd750ea..b84551db 100644 --- a/packages/vantui/src/swiper/swiper.tsx +++ b/packages/vantui/src/swiper/swiper.tsx @@ -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 (