zhaowei
2 天以前 80a8050560fdd4cc18aee57c3ed176a9019dec2a
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<template>
  <a-modal title="预览" :visible="visible" width="50%" :footer="null" @cancel="visible=false">
    <template v-for="(item,index) in imageUrlArr">
      <img :src="getImageItemUrl(item)" width="100%;"/>
 
      <a-divider v-if="index+1<imageUrlArr.length" style="margin:20px 0;background-color: #000"></a-divider>
    </template>
  </a-modal>
</template>
 
<script>
  export default {
    name: 'ImagesPreviewModal',
    props: {
      imageListUrl: {
        type: String,
        default: ''
      }
    },
    data() {
      return {
        visible: false
      }
    },
    computed: {
      imageUrlArr() {
        return JSON.parse(this.imageListUrl).map(item => item.filePath)
      }
    },
    methods: {
      getImageItemUrl(imageItemSrcSuffix) {
        return `${window._CONFIG['domianURL']}/${imageItemSrcSuffix}`
      }
    }
  }
</script>
 
<style scoped lang="less">
  /deep/ .ant-modal {
    height: 70%;
    overflow: hidden;
 
    .ant-modal-content {
      height: 100%;
      display: flex;
      flex-direction: column;
      overflow: hidden;
 
      ::-webkit-scrollbar {
        width: 8px;
        height: 8px;
      }
 
      .ant-modal-body {
        flex: 1;
        overflow: auto;
      }
    }
  }
 
</style>