topSwiper.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <view class="carousel">
  3. <swiper indicator-dots :circular="true" duration="400">
  4. <swiper-item class="swiper-item" v-if="video">
  5. <video class="image-wrapper" :src="video"></video>
  6. </swiper-item>
  7. <swiper-item class="swiper-item" v-for="(item, index) in imgList" :key="index">
  8. <view class="image-wrapper">
  9. <image :src="item" class="loaded" mode="aspectFill"></image>
  10. </view>
  11. </swiper-item>
  12. </swiper>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. props: {
  18. imgList: {
  19. type: Array,
  20. default: function() {
  21. return []
  22. }
  23. },
  24. video: {
  25. type: String,
  26. default: function() {
  27. return ''
  28. }
  29. },
  30. },
  31. data() {
  32. return {
  33. };
  34. },
  35. };
  36. </script>
  37. <style lang="scss">
  38. .carousel {
  39. /* #ifdef APP-PLUS */
  40. padding-top: var(--status-bar-height);
  41. /* #endif */
  42. height: 700rpx;
  43. position: relative;
  44. swiper {
  45. height: 100%;
  46. }
  47. .image-wrapper {
  48. width: 100%;
  49. height: 100%;
  50. }
  51. .swiper-item {
  52. display: flex;
  53. justify-content: center;
  54. align-content: center;
  55. height: 700rpx;
  56. overflow: hidden;
  57. image {
  58. width: 100%;
  59. height: 100%;
  60. }
  61. }
  62. }
  63. </style>