SwiperNzgx.vue 3.8 KB

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