s-image-banner.vue 1023 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <!-- 装修图文组件:图片轮播 -->
  2. <template>
  3. <su-swiper
  4. :list="imgList"
  5. :dotStyle="data.indicator === 'dot' ? 'long' : 'tag'"
  6. imageMode="scaleToFill"
  7. dotCur="bg-mask-40"
  8. :seizeHeight="300"
  9. :autoplay="data.autoplay"
  10. :interval="data.interval * 1000"
  11. :mode="data.type"
  12. :height="height"
  13. />
  14. </template>
  15. <script setup>
  16. import { computed } from 'vue';
  17. import sheep from '@/sheep';
  18. // 轮播图
  19. const props = defineProps({
  20. data: {
  21. type: Object,
  22. default: () => ({}),
  23. },
  24. styles: {
  25. type: Object,
  26. default: () => ({}),
  27. },
  28. height: {
  29. type: Number,
  30. },
  31. });
  32. const imgList = computed(() =>
  33. props.data.items.map((item) => {
  34. const src = item.type === 'img' ? item.imgUrl : item.videoUrl;
  35. return {
  36. ...item,
  37. type: item.type === 'img' ? 'image' : 'video',
  38. src: sheep.$url.cdn(src),
  39. poster: sheep.$url.cdn(item.imgUrl),
  40. };
  41. }),
  42. );
  43. </script>
  44. <style></style>