SwiperNzgx.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div class="swiper">
  3. <!-- 农副产品供销网 -->
  4. <el-carousel
  5. class="roll_in"
  6. :interval="3333"
  7. height="405px"
  8. indicator-class="custom-indicator"
  9. arrow="always"
  10. @change="change_fun"
  11. v-if="imgData">
  12. <el-carousel-item v-for="(item, index) in imgData" :key="item">
  13. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title" :key="item.id"
  14. :target="item.islink == 1 ? '_blank' : '_self'">
  15. <img :src="item.imgurl" alt="item.title">
  16. <span class="swiper_dot1 dot1 roll_phone_none">
  17. {{ item.title }}
  18. </span>
  19. <span class="roll_dot2 roll_pc_none">
  20. {{ item.title }}
  21. </span>
  22. </NuxtLink>
  23. </el-carousel-item>
  24. <div class="roll_num_box phone_none">
  25. <span class="roll_num_box_new">{{ roll_num_this + 1 }}</span>
  26. /
  27. {{ roll_num_lang }}
  28. </div>
  29. </el-carousel>
  30. </div>
  31. </template>
  32. <script setup>
  33. import { ElCarousel, ElCarouselItem } from 'element-plus'
  34. import { ref } from 'vue'
  35. const roll_num_lang = ref(4);
  36. const roll_num_this = ref(0);
  37. const props = defineProps({
  38. imgData: {
  39. type: Array,
  40. default: []
  41. }
  42. })
  43. const change_fun = (the_1) => {
  44. roll_num_this.value = the_1
  45. }
  46. </script>
  47. <style lang="less" scoped>
  48. .roll_num_box {
  49. position: absolute;
  50. z-index: 2;
  51. left: 60px;
  52. bottom: 0px;
  53. height: 60px;
  54. line-height: 60px;
  55. color: #fff;
  56. font-size: 16px;
  57. .roll_num_box_new {
  58. font-size: 20px;
  59. }
  60. }
  61. .dot1 {
  62. display: block;
  63. word-break: keep-all;
  64. white-space: nowrap;
  65. overflow: hidden;
  66. text-overflow: ellipsis;
  67. }
  68. .swiper {
  69. width: 100%;
  70. height: 405px;
  71. position: relative;
  72. img {
  73. width: 100%;
  74. height: 405px;
  75. }
  76. .swiper_dot1 {
  77. display: block;
  78. width: 100%;
  79. line-height: 60px;
  80. height: 60px;
  81. color: #fff;
  82. font-size: 18px;
  83. text-indent: 20px;
  84. position: absolute;
  85. bottom: 0;
  86. left: 0;
  87. z-index: 10;
  88. box-sizing: border-box;
  89. padding: 0 144px;
  90. background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
  91. }
  92. }
  93. .el-carousel {
  94. /deep/.el-carousel__arrow i {
  95. font-size: 33px !important;
  96. }
  97. .roll_1_box {
  98. position: relative;
  99. }
  100. /deep/.el-carousel__arrow--left {
  101. position: absolute;
  102. width: 35px;
  103. height: 57px;
  104. color: #fff;
  105. background: rgba(0, 0, 0, 0);
  106. left: 9px;
  107. border: none;
  108. border-radius: 0;
  109. top: 100%;
  110. margin-top: -28px;
  111. }
  112. /deep/.el-carousel__arrow--right {
  113. width: 35px;
  114. height: 57px;
  115. color: #fff;
  116. background: rgba(0, 0, 0, 0);
  117. position: absolute;
  118. right: 9;
  119. border: none;
  120. border-radius: 0;
  121. top: 100%;
  122. margin-top: -28px;
  123. }
  124. /deep/ .el-carousel__indicators {
  125. // 指示器
  126. left: unset;
  127. transform: unset;
  128. right: 10px;
  129. bottom: 11px;
  130. }
  131. /deep/ .el-carousel__button {
  132. // 指示器按钮
  133. width: 10px;
  134. height: 10px;
  135. border: none;
  136. border-radius: 5px;
  137. background: #fff;
  138. opacity: 1;
  139. }
  140. /deep/ .is-active .el-carousel__button {
  141. // 指示器激活按钮
  142. background: #a91b33;
  143. width: 25px;
  144. opacity: 1;
  145. }
  146. /deep/ .el-carousel__container {
  147. height: 100%;
  148. }
  149. }
  150. .custom-indicator button {
  151. background-color: #fff;
  152. opacity: 1;
  153. width: 8px;
  154. height: 8px;
  155. }
  156. .custom-indicator button.is-active {
  157. background-color: #DD7D18;
  158. width: 58px;
  159. opacity: 1;
  160. }
  161. </style>
  162. <style lang="less" scoped>
  163. @media screen and (min-width:801px){/*pc*/
  164. .roll_in{height:405px;}
  165. .swiper /deep/.el-carousel__indicators{display:none;}
  166. .roll_pc_none{display:none!important;}
  167. .pc_none{display:none;}
  168. }
  169. @media screen and (max-width:800px){/*ipad_phone*/
  170. .swiper{ height:55vw; width:92%;margin:15px auto 0px;}
  171. .roll_in{height:55vw;}
  172. .swiper /deep/ul.el-carousel__indicators{width:100%; right:0px;text-align:center;}
  173. .swiper img{width:100%;height:100%;}
  174. .roll_in{height:55vw;}
  175. .el-carousel /deep/.el-icon svg{width:.4em;display:none;}
  176. .el-carousel /deep/.el-carousel__button{width:10px;height:10px;margin:0px 4px;}
  177. .roll_dot2{
  178. width:100%;line-height:22px; height:54px;font-size:16px;
  179. padding:10px 10px 0;top:0px;
  180. display: inline-block;
  181. box-sizing: border-box;
  182. position: absolute;
  183. left: 0;
  184. font-family: Source Han Sans, Source Han Sans;
  185. font-weight: 800;
  186. color: #FFFFFF;
  187. background: linear-gradient(to bottom, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
  188. overflow:hidden;display:-webkit-box!important;-webkit-box-orient:vertical;-webkit-line-clamp:2;
  189. }
  190. /deep/.el-carousel .el-carousel__button{width:10px!important;}
  191. /deep/.el-carousel .el-carousel__indicators{bottom:0px;}
  192. .roll_phone_none{display:none!important;}
  193. .phone_none{display:none;}
  194. }
  195. </style>