ImageTable.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <div class="waterfall" v-loading="props.loading">
  3. <div class="waterfall-item" v-for="item in props.list" :key="item.id">
  4. <a target="_blank" :href="item.url">
  5. <img class="material-img" :src="item.url" />
  6. <div class="item-name">{{ item.name }}</div>
  7. </a>
  8. <el-row justify="center">
  9. <el-button
  10. type="danger"
  11. circle
  12. @click="emit('delete', item.id)"
  13. v-hasPermi="['mp:material:delete']"
  14. >
  15. <Icon icon="ep:delete" />
  16. </el-button>
  17. </el-row>
  18. </div>
  19. </div>
  20. </template>
  21. <script lang="ts" setup>
  22. const props = defineProps<{
  23. list: any[]
  24. loading: boolean
  25. }>()
  26. const emit = defineEmits<{
  27. (e: 'delete', v: number)
  28. }>()
  29. </script>
  30. <style lang="scss" scoped>
  31. @media (width >= 992px) and (width <= 1300px) {
  32. .waterfall {
  33. column-count: 3;
  34. }
  35. p {
  36. color: red;
  37. }
  38. }
  39. @media (width >= 768px) and (width <= 991px) {
  40. .waterfall {
  41. column-count: 2;
  42. }
  43. p {
  44. color: orange;
  45. }
  46. }
  47. @media (width <= 767px) {
  48. .waterfall {
  49. column-count: 1;
  50. }
  51. }
  52. .waterfall {
  53. width: 100%;
  54. column-gap: 10px;
  55. column-count: 5;
  56. margin-top: 10px;
  57. /* 非繁源码:增加 10px,避免顶着上面 */
  58. }
  59. .waterfall-item {
  60. padding: 10px;
  61. margin-bottom: 10px;
  62. break-inside: avoid;
  63. border: 1px solid #eaeaea;
  64. }
  65. .material-img {
  66. width: 100%;
  67. }
  68. p {
  69. line-height: 30px;
  70. }
  71. </style>