mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-22 02:50:00 +08:00
Pre Merge pull request !247 from lingdeng/dev
This commit is contained in:
commit
644618bc36
@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-image
|
<el-image
|
||||||
:src="`${realSrc}`"
|
|
||||||
fit="cover"
|
|
||||||
:style="`width:${realWidth};height:${realHeight};`"
|
|
||||||
:preview-src-list="realSrcList"
|
:preview-src-list="realSrcList"
|
||||||
|
:src="`${realSrc}`"
|
||||||
|
:style="`width:${realWidth};height:${realHeight};`"
|
||||||
|
fit="cover"
|
||||||
>
|
>
|
||||||
<div slot="error" class="image-slot">
|
<div slot="error" class="image-slot">
|
||||||
<i class="el-icon-picture-outline"></i>
|
<i class="el-icon-picture-outline"></i>
|
||||||
@ -12,6 +12,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {listByIds} from "@/api/system/oss";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ImagePreview",
|
name: "ImagePreview",
|
||||||
@ -29,24 +30,38 @@ export default {
|
|||||||
default: ""
|
default: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
fileList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
src: {
|
||||||
|
async handler(val) {
|
||||||
|
if (val) {
|
||||||
|
await listByIds(this.src).then(res => {
|
||||||
|
res.data.forEach(item => {
|
||||||
|
this.fileList.push(item.url);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deep: true,
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
realSrc() {
|
realSrc() {
|
||||||
if (!this.src) {
|
if (!this.fileList) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let real_src = this.src.split(",")[0];
|
return this.fileList[0];
|
||||||
return real_src;
|
|
||||||
},
|
},
|
||||||
realSrcList() {
|
realSrcList() {
|
||||||
if (!this.src) {
|
if (!this.fileList) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let real_src_list = this.src.split(",");
|
return this.fileList;
|
||||||
let srcList = [];
|
|
||||||
real_src_list.forEach(item => {
|
|
||||||
return srcList.push(item);
|
|
||||||
});
|
|
||||||
return srcList;
|
|
||||||
},
|
},
|
||||||
realWidth() {
|
realWidth() {
|
||||||
return typeof this.width == "string" ? this.width : `${this.width}px`;
|
return typeof this.width == "string" ? this.width : `${this.width}px`;
|
||||||
@ -63,13 +78,16 @@ export default {
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
background-color: #ebeef5;
|
background-color: #ebeef5;
|
||||||
box-shadow: 0 0 5px 1px #ccc;
|
box-shadow: 0 0 5px 1px #ccc;
|
||||||
|
|
||||||
::v-deep .el-image__inner {
|
::v-deep .el-image__inner {
|
||||||
transition: all 0.3s;
|
transition: all 0.3s;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
transform: scale(1.2);
|
transform: scale(1.2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .image-slot {
|
::v-deep .image-slot {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user