s-image-banner.vue 966 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. />
  13. </template>
  14. <script setup>
  15. import { computed } from 'vue';
  16. import sheep from '@/sheep';
  17. // 轮播图
  18. const props = defineProps({
  19. data: {
  20. type: Object,
  21. default: () => ({}),
  22. },
  23. styles: {
  24. type: Object,
  25. default: () => ({}),
  26. },
  27. });
  28. const imgList = computed(() =>
  29. props.data.items.map((item) => {
  30. const src = item.type === 'img' ? item.imgUrl : item.videoUrl;
  31. return {
  32. ...item,
  33. type: item.type === 'img' ? 'image' : 'video',
  34. src: sheep.$url.cdn(src),
  35. poster: sheep.$url.cdn(item.imgUrl),
  36. };
  37. }),
  38. );
  39. </script>
  40. <style></style>