s-image-banner.vue 923 B

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