media-carousel.scss 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* components/media-carousel/media-carousel.wxss */
  2. .media-carousel {
  3. position: relative;
  4. width: 100%;
  5. height: 100%;
  6. overflow: hidden;
  7. border-radius: 16rpx;
  8. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
  9. }
  10. /* 自适应高度模式 */
  11. .media-carousel.adaptive-height {
  12. /* height: auto; */
  13. min-height: 400rpx;
  14. }
  15. .carousel-swiper {
  16. width: 100%;
  17. height: 100%;
  18. }
  19. .carousel-item {
  20. width: 100%;
  21. height: 100%;
  22. position: relative;
  23. }
  24. .adaptive-height .carousel-item {
  25. height: auto;
  26. }
  27. /* 图片容器样式 */
  28. .image-container {
  29. width: 100%;
  30. height: 100%;
  31. position: relative;
  32. overflow: hidden;
  33. background-color: #f5f5f5; /* 添加背景色,避免空白区域突兀 */
  34. display: flex;
  35. align-items: center;
  36. justify-content: center;
  37. }
  38. .adaptive-height .image-container {
  39. height: auto;
  40. background-color: transparent;
  41. }
  42. .carousel-image {
  43. width: 100%;
  44. height: 100%;
  45. display: block;
  46. /* 确保图片在aspectFit模式下居中显示 */
  47. object-position: center;
  48. }
  49. .adaptive-height .carousel-image {
  50. height: auto;
  51. max-height: none;
  52. }
  53. .image-title {
  54. position: absolute;
  55. bottom: 0;
  56. left: 0;
  57. right: 0;
  58. background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  59. color: #fff;
  60. padding: 20rpx;
  61. font-size: 28rpx;
  62. line-height: 1.4;
  63. z-index: 2;
  64. }
  65. /* 视频容器样式 */
  66. .video-container {
  67. width: 100%;
  68. height: 100%;
  69. position: relative;
  70. overflow: hidden;
  71. }
  72. .carousel-video {
  73. width: 100%;
  74. height: 100%;
  75. display: block;
  76. }
  77. .video-title {
  78. position: absolute;
  79. bottom: 0;
  80. left: 0;
  81. right: 0;
  82. background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  83. color: #fff;
  84. padding: 20rpx;
  85. font-size: 28rpx;
  86. line-height: 1.4;
  87. z-index: 2;
  88. }