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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
| <template>
| <div>
| {{ src }}
| <img
| class="el-upload-list__item-thumbnail"
| :src="src" alt=""
| :style="`width: ${width}px;height: ${height}px;`"
| @click="handlePictureCardPreview()"
| >
| <el-image-viewer
| v-if="showViewer"
| :on-close="closeViewer"
| :initialIndex="tempIndex"
| :url-list="previewSrcList"
| :z-index="3000"
| />
| </div>
|
| </template>
|
| <script>
| import ElImageViewer from 'element-ui/packages/image/src/image-viewer'
| export default {
| components: {
| ElImageViewer
| },
| props: {
| src: {
| type: String,
| default: ''
| },
| width: {
| type: Number,
| default: 100
| },
| height: {
| type: Number,
| default: 100
| },
| previewSrcList: {
| type: Array,
| default: () => []
| }
| },
| data() {
| return {
| tempIndex: 0,
| showViewer: false,
| }
| },
|
| methods: {
| handlePictureCardPreview() {
| console.log(this.src);
| this.tempIndex = this.srcList.findIndex(item => item == this.src )
| this.showViewer = true
| },
| closeViewer() {
| this.showViewer = false
| },
| },
| }
| </script>
|
| <style lang="scss" scoped>
| ::v-deep .el-upload--picture-card{
| width: 90px !important;
| height: 90px !important;
| }
| ::v-deep .el-upload-list__item {
| width: 90px !important;
| height: 90px !important;
| }
| .icon {
| -webkit-transform: translate(-50%,-50%);
| -ms-transform: translate(-50%,-50%);
| transform: translate(0%, -85%);
| }
| ::v-deep .el-upload-list__item {
| width: 90px !important;
| height: 90px !important;
| }
| </style>
|
|