当前位置:   article > 正文

vue+轮播_vue实现div轮播效果

vue实现div轮播效果

  1. <template>
  2. <div class="boxItem">
  3. <div class="swiper-container">
  4. <div class="swiper-wrapper">
  5. <div class="swiper-slide" v-for="item in list">
  6. <div class="miao-box">
  7. <img class="miao-img" :src=item.img alt="">
  8. <div class="miao-item">
  9. <div class="label">拍摄时间:</div>
  10. {{item.time}}
  11. </div>
  12. </div>
  13. <div class="miao-box1">
  14. <div class="miao-item">
  15. <div class="label">设备编号:</div>
  16. {{item.num}}
  17. </div>
  18. <div class="miao-item miao-item1">
  19. <div class="label">设备状态:</div>
  20. {{item.state}}
  21. </div>
  22. <div class="miao-item">
  23. <div class="label">地理坐标:</div>
  24. {{item.coordinate}}
  25. </div>
  26. <div class="miao-item">
  27. <div class="label">设备位置:</div>
  28. {{item.position}}
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <!-- Add Pagination -->
  34. <div class="swiper-pagination"></div>
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. export default {
  40. name: "seedlingGrowth",
  41. data(){
  42. return{
  43. swiper:'',
  44. list:[
  45. {
  46. img:require('../../../../img/planting/siqing/miao1.png'),
  47. num:'011',
  48. state:'在线',
  49. coordinate:'23°26′21.448″N',
  50. position:'泊里镇012号农田',
  51. time:'2023-05-06'
  52. },{
  53. img:require('../../../../img/planting/siqing/miao2.png'),
  54. num:'012',
  55. state:'在线',
  56. coordinate:'23°26′21.448″N',
  57. position:'泊里镇012号农田',
  58. time:'2023-05-06'
  59. },{
  60. img:require('../../../../img/planting/siqing/miao1.png'),
  61. num:'013',
  62. state:'在线',
  63. coordinate:'23°26′21.448″N',
  64. position:'泊里镇012号农田',
  65. time:'2023-05-06'
  66. },{
  67. img:require('../../../../img/planting/siqing/miao2.png'),
  68. num:'014',
  69. state:'在线',
  70. coordinate:'23°26′21.448″N',
  71. position:'泊里镇012号农田',
  72. time:'2023-05-06'
  73. },
  74. ]
  75. }
  76. },
  77. methods:{
  78. mySwiper(){
  79. this.swiper = new Swiper('.swiper-container', {
  80. pagination: '.swiper-pagination',
  81. slidesPerView: 2,
  82. paginationClickable: true,
  83. spaceBetween: 10,
  84. autoplay: 5000, //时长
  85. autoplayDisableOnInteraction: false, //点击不会取消自动
  86. });
  87. }
  88. },
  89. mounted() {
  90. this.mySwiper()
  91. },
  92. beforeDestroy() {
  93. }
  94. }
  95. </script>
  96. <style lang="scss" scoped>
  97. .swiper-container{
  98. width: 22vw;
  99. margin-left: 1vw;
  100. height: 100%;
  101. .swiper-pagination{
  102. bottom: 0;
  103. }
  104. .swiper-slide {
  105. //width: 10.5vw !important;
  106. //margin-right: 10px !important;
  107. height: 21vh;
  108. margin-top: 0.5vh;
  109. .miao-box{
  110. width: 100%;
  111. height: 9.72vh;
  112. position: relative;
  113. .miao-img{
  114. width: 100%;
  115. height: 100%;
  116. }
  117. .miao-item{
  118. position: absolute;
  119. bottom: 0;
  120. width: 100%;
  121. height: 3vh;
  122. padding: 0.3vh 0.5vh;
  123. background: rgba(31, 31, 31, 0.55);
  124. color: #cbcbcb;
  125. display: flex;
  126. justify-content: flex-end;
  127. align-items: flex-end;
  128. .label{
  129. width: 3.2vw;
  130. color: #ffffff;
  131. }
  132. }
  133. }
  134. .miao-box1{
  135. width: 100%;
  136. height: calc(100% - 9.72vh);
  137. display: flex;
  138. flex-wrap: wrap;
  139. background: #0c3378;
  140. .miao-item{
  141. width: 100%;
  142. margin-top: 0.5vh;
  143. height: 2vh;
  144. display: flex;
  145. .label{
  146. width: 3.2vw;
  147. color: #ffffff;
  148. }
  149. }
  150. .miao-item1{
  151. color: #41ff65;
  152. }
  153. }
  154. }
  155. }
  156. </style>

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/251108?site
推荐阅读
相关标签
  

闽ICP备14008679号