whychdw
2021-09-09 eadfc72476a7801e086dc4c92dfb4945a8591549
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<template>
  <div class="image-list-container">
    <div class="image-block" v-for="(item, key) in urls" :key="'key' + key">
      <el-image :style="getImageStyle" :src="item" :preview-src="list">
      </el-image>
    </div>
  </div>
</template>
 
<script>
export default {
  props: {
    width: {
      type: [String, Number],
      default: 100,
    },
    urls: {
      type: Array,
      default() {
        return [];
      },
    },
  },
  computed: {
    getImageStyle() {
      return {
        width: this.width + "px",
      };
    },
    list() {
      return this.urls.map((item) => {
        return item;
      });
    },
  },
};
</script>
 
<style scoped>
.image-block {
  display: inline-block;
  box-sizing: border-box;
  padding: 8px;
}
</style>