SmallSwiperTwo.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div class="swiper" v-if="data.length>0">
  3. <el-carousel
  4. :interval="5000"
  5. class="roll_in"
  6. indicator-class="custom-indicator"
  7. @change="handleIndicatorChange">
  8. <el-carousel-item v-for="item in data" :key="item">
  9. <NuxtLink
  10. :to="`/${item.pinyin}/${item.id}.html`"
  11. :title="item.title">
  12. <img :src="item.imgurl" :alt="item.title">
  13. <span class="swiper_dot1 dot1 roll_phone_none">
  14. {{ item.title }}
  15. </span>
  16. <span class="roll_dot2 roll_pc_none">
  17. {{ item.title }}
  18. </span>
  19. </NuxtLink>
  20. </el-carousel-item>
  21. </el-carousel>
  22. </div>
  23. </template>
  24. <script setup>
  25. import { ElCarousel, ElCarouselItem } from 'element-plus'
  26. //获取焦点图数据 start---------------------------------------->
  27. const props = defineProps({
  28. data:Array
  29. })
  30. let currentIndex = ref(0)
  31. let handleIndicatorChange = (val) => {
  32. currentIndex.value = val
  33. }
  34. //获取焦点图数据 end---------------------------------------->
  35. </script>
  36. <style lang="less" scoped>
  37. .dot1 {
  38. display: block;
  39. word-break: keep-all;
  40. white-space: nowrap;
  41. overflow: hidden;
  42. text-overflow: ellipsis;
  43. }
  44. .swiper {
  45. width: 100%;
  46. height: 405px;
  47. position: relative;
  48. img {
  49. width: 100%;
  50. height: 405px;
  51. }
  52. .swiper_dot1 {
  53. display: block;
  54. width: 100%;
  55. line-height: 60px;
  56. height: 60px;
  57. color: #fff;
  58. font-size: 24px;
  59. text-indent: 20px;
  60. position: absolute;
  61. bottom: 0;
  62. left: 0;
  63. z-index: 10;
  64. box-sizing: border-box;
  65. padding-right: 244px;
  66. background: rgba(0, 0, 0, .5);
  67. }
  68. }
  69. .el-carousel {
  70. /deep/.el-carousel__arrow i {
  71. font-size: 30px !important;
  72. }
  73. /deep/.el-carousel__arrow--left {
  74. left: 16px;
  75. width: 35px;
  76. height: 57px;
  77. color: #616358;
  78. background: #dcdedc;
  79. position: absolute;
  80. left: 0px;
  81. border: none;
  82. border-radius: 0;
  83. }
  84. /deep/.el-carousel__arrow--right {
  85. right: 16px;
  86. width: 35px;
  87. height: 57px;
  88. color: #616358;
  89. background: #dcdedc;
  90. position: absolute;
  91. right: 0;
  92. border: none;
  93. border-radius: 0;
  94. }
  95. /deep/ .el-carousel__indicators {
  96. // 指示器
  97. left: unset;
  98. transform: unset;
  99. right: 10px;
  100. bottom: 11px;
  101. }
  102. /deep/ .el-carousel__button {
  103. // 指示器按钮
  104. width: 10px;
  105. height: 10px;
  106. border: none;
  107. border-radius: 5px;
  108. background: #ccc;
  109. opacity: 1;
  110. }
  111. /deep/ .is-active .el-carousel__button {
  112. // 指示器激活按钮
  113. background: #fff;
  114. width: 58px;
  115. opacity: 1;
  116. }
  117. /deep/ .el-carousel__container {
  118. height: 100%;
  119. }
  120. }
  121. .custom-indicator button {
  122. background-color: #fff;
  123. opacity: 1;
  124. width: 8px;
  125. height: 8px;
  126. }
  127. .custom-indicator button.is-active {
  128. background-color: #DD7D18;
  129. width: 58px;
  130. opacity: 1;
  131. }
  132. </style>
  133. <style lang="less" scoped>
  134. @media screen and (min-width:801px){/*pc*/
  135. .roll_in{height:405px;}
  136. .swiper /deep/.el-carousel__indicators{display:none;}
  137. .roll_pc_none{display:none!important;}
  138. .pc_none{display:none;}
  139. }
  140. @media screen and (max-width:800px){/*ipad_phone*/
  141. .swiper{height:100%;}
  142. .roll_in{height:55vw;}
  143. .swiper /deep/ul.el-carousel__indicators{width:100%; right:0px;text-align:center;}
  144. .swiper img{width:100%;height:100%;}
  145. .roll_in{height:55vw;}
  146. .el-carousel /deep/.el-icon svg{width:.4em;display:none;}
  147. .el-carousel /deep/.el-carousel__button{width:10px;height:10px;margin:0px 4px;}
  148. .roll_dot2{
  149. width:100%;line-height:22px; height:54px;font-size:16px;
  150. padding:10px 10px 0;top:0px;
  151. display: inline-block;
  152. box-sizing: border-box;
  153. position: absolute;
  154. left: 0;
  155. font-family: Source Han Sans, Source Han Sans;
  156. font-weight: 800;
  157. color: #FFFFFF;
  158. background: linear-gradient(to bottom, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
  159. overflow:hidden;display:-webkit-box!important;-webkit-box-orient:vertical;-webkit-line-clamp:2;
  160. }
  161. /deep/.el-carousel .el-carousel__button{width:10px!important;}
  162. /deep/.el-carousel .el-carousel__indicators{bottom:0px;}
  163. /deep/.el-carousel .is-active .el-carousel__button{background:#489d97;}
  164. .swiper /deep/.el-carousel__arrow{display:none;}
  165. .roll_phone_none{display:none!important;}
  166. .phone_none{display:none;}
  167. }
  168. </style>