使用autoHeight: true;然后把父元素的高度设置为height:auto !important; .swiper-container{ height:auto !important; } <script> var swiper = new Swiper('.swiper-container', { autoHeight: true, //高度随内容变化 }); </script>