carousel.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <div class="carousel">
  3. <swiper :options="swiperOption">
  4. <swiper-slide></swiper-slide>
  5. <!-- <swiper-slide></swiper-slide>-->
  6. <!-- <swiper-slide></swiper-slide>-->
  7. <!-- <swiper-slide></swiper-slide>-->
  8. <div class="swiper-pagination" slot="pagination"></div>
  9. </swiper>
  10. </div>
  11. </template>
  12. <script>
  13. export default {
  14. name: 'carousel',
  15. data() {
  16. return {
  17. swiperOption: {
  18. pagination: {
  19. el: '.swiper-pagination',
  20. clickable : true,
  21. bulletClass: 'my-bullet',
  22. bulletActiveClass: 'my-bullet-active'
  23. },
  24. effect:'fade',
  25. autoplay: {
  26. delay: 10000,
  27. disableOnInteraction: true
  28. },
  29. }
  30. }
  31. }
  32. }
  33. </script>
  34. <style lang="less" scoped>
  35. .carousel {
  36. width: 100%;
  37. height: 100%;
  38. position: relative;
  39. .swiper-container {
  40. height: 100%;
  41. .swiper-slide {
  42. background-position: center;
  43. background-repeat: no-repeat;
  44. background-size: cover;
  45. background-attachment: scroll;
  46. height: 100%;
  47. text-align: center;
  48. font-size: 18px;
  49. //&:nth-of-type(1) {
  50. // background: url('https://file.funcheergame.com/office/image/index/carousel_04.png') center top / cover no-repeat;
  51. //}
  52. //&:nth-of-type(2) {
  53. // background: url('https://file.funcheergame.com/office/image/index/carousel_03.png') center top / cover no-repeat;
  54. //}
  55. &:nth-of-type(1) {
  56. background: url('https://file.funcheergame.com/office/image/index/carousel_01.png') center top / cover no-repeat;
  57. }
  58. //&:nth-of-type(4) {
  59. // background: url('https://file.funcheergame.com/office/image/index/carousel_02.png') center top / cover no-repeat;
  60. //}
  61. }
  62. }
  63. }
  64. </style>