s-image-banner.vue 909 B

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