SwiperNzgx.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <div class="swiper">
  3. <!-- 农副产品供销网 -->
  4. <el-carousel :interval="3333" height="405px" indicator-position="none" arrow="always" @change="change_fun"
  5. v-if="imgData">
  6. <el-carousel-item v-for="(item, index) in imgData" :key="item">
  7. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title" :key="item.id"
  8. :target="item.islink == 1 ? '_blank' : '_self'">
  9. <img :src="item.imgurl" alt="item.title">
  10. <span class="swiper_dot1 dot1">
  11. {{ item.title }}
  12. </span>
  13. </NuxtLink>
  14. </el-carousel-item>
  15. <div class="roll_num_box">
  16. <span class="roll_num_box_new">{{ roll_num_this + 1 }}</span>
  17. /
  18. {{ roll_num_lang }}
  19. </div>
  20. </el-carousel>
  21. </div>
  22. </template>
  23. <script setup>
  24. import { ElCarousel, ElCarouselItem } from 'element-plus'
  25. import { ref } from 'vue'
  26. const roll_num_lang = ref(4);
  27. const roll_num_this = ref(0);
  28. const props = defineProps({
  29. imgData: {
  30. type: Array,
  31. default: []
  32. }
  33. })
  34. const change_fun = (the_1) => {
  35. roll_num_this.value = the_1
  36. }
  37. </script>
  38. <style lang="less" scoped>
  39. .roll_num_box {
  40. position: absolute;
  41. z-index: 2;
  42. left: 60px;
  43. bottom: 0px;
  44. height: 60px;
  45. line-height: 60px;
  46. color: #fff;
  47. font-size: 16px;
  48. .roll_num_box_new {
  49. font-size: 20px;
  50. }
  51. }
  52. .dot1 {
  53. display: block;
  54. word-break: keep-all;
  55. white-space: nowrap;
  56. overflow: hidden;
  57. text-overflow: ellipsis;
  58. }
  59. .swiper {
  60. width: 100%;
  61. height: 405px;
  62. position: relative;
  63. img {
  64. width: 100%;
  65. height: 405px;
  66. }
  67. .swiper_dot1 {
  68. display: block;
  69. width: 100%;
  70. line-height: 60px;
  71. height: 60px;
  72. color: #fff;
  73. font-size: 18px;
  74. text-indent: 20px;
  75. position: absolute;
  76. bottom: 0;
  77. left: 0;
  78. z-index: 10;
  79. box-sizing: border-box;
  80. padding: 0 144px;
  81. background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
  82. }
  83. }
  84. .el-carousel {
  85. /deep/.el-carousel__arrow i {
  86. font-size: 33px !important;
  87. }
  88. .roll_1_box {
  89. position: relative;
  90. }
  91. /deep/.el-carousel__arrow--left {
  92. position: absolute;
  93. width: 35px;
  94. height: 57px;
  95. color: #fff;
  96. background: rgba(0, 0, 0, 0);
  97. left: 9px;
  98. border: none;
  99. border-radius: 0;
  100. top: 100%;
  101. margin-top: -28px;
  102. }
  103. /deep/.el-carousel__arrow--right {
  104. width: 35px;
  105. height: 57px;
  106. color: #fff;
  107. background: rgba(0, 0, 0, 0);
  108. position: absolute;
  109. right: 9;
  110. border: none;
  111. border-radius: 0;
  112. top: 100%;
  113. margin-top: -28px;
  114. }
  115. /deep/ .el-carousel__indicators {
  116. // 指示器
  117. left: unset;
  118. transform: unset;
  119. right: 10px;
  120. bottom: 11px;
  121. }
  122. /deep/ .el-carousel__button {
  123. // 指示器按钮
  124. width: 10px;
  125. height: 10px;
  126. border: none;
  127. border-radius: 5px;
  128. background: #fff;
  129. opacity: 1;
  130. }
  131. /deep/ .is-active .el-carousel__button {
  132. // 指示器激活按钮
  133. background: #255590;
  134. width: 25px;
  135. opacity: 1;
  136. }
  137. /deep/ .el-carousel__container {
  138. height: 100%;
  139. }
  140. }
  141. .custom-indicator button {
  142. background-color: #fff;
  143. opacity: 1;
  144. width: 8px;
  145. height: 8px;
  146. }
  147. .custom-indicator button.is-active {
  148. background-color: #DD7D18;
  149. width: 58px;
  150. opacity: 1;
  151. }
  152. </style>