ShowImages.vue 946 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <div class="show-box-container">
  3. <div v-for="(image, index) in imageList" :key="index" class="image-preview">
  4. <el-image
  5. :src="image.url"
  6. :zoom-rate="1.2"
  7. :max-scale="7"
  8. :min-scale="0.2"
  9. :preview-src-list="imageList.map((item) => item.url)"
  10. show-progress
  11. :initial-index="index"
  12. fit="contain"
  13. />
  14. </div>
  15. </div>
  16. </template>
  17. <script setup lang="ts">
  18. // import type { ImageItem } from '@/types/disaster-control';
  19. import { computed } from 'vue';
  20. const props = defineProps<{
  21. imageList?: string;
  22. }>();
  23. const imageList = computed(() => {
  24. if (!props.imageList) return [];
  25. return JSON.parse(props.imageList);
  26. });
  27. </script>
  28. <style scoped>
  29. .show-box-container {
  30. display: flex;
  31. flex-wrap: wrap;
  32. gap: 5px;
  33. width: 100%;
  34. }
  35. .image-preview {
  36. width: 100px;
  37. height: 100px;
  38. border-radius: 4px;
  39. }
  40. </style>