media-carousel.scss 1.7 KB

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