This commit is contained in:
qsh
2023-03-21 00:53:28 +08:00
parent 953377e655
commit 955687d473
171 changed files with 7149 additions and 7341 deletions

View File

@@ -1,33 +1,28 @@
<template>
<el-image
:src="`${realSrc}`"
fit="cover"
:style="`width:${realWidth};height:${realHeight};`"
:preview-src-list="realSrcList"
>
<el-image :src="`${realSrc}`" fit="cover" :style="`width:${realWidth};height:${realHeight};`" :preview-src-list="realSrcList">
<div slot="error" class="image-slot">
<i class="el-icon-picture-outline"></i>
<i class="el-icon-picture-outline" />
</div>
</el-image>
</template>
<script>
import { isExternal } from "@/utils/validate";
import { isExternal } from '@/utils/validate';
export default {
name: "ImagePreview",
name: 'ImagePreview',
props: {
src: {
type: String,
default: ""
default: ''
},
width: {
type: [Number, String],
default: ""
default: ''
},
height: {
type: [Number, String],
default: ""
default: ''
}
},
computed: {
@@ -35,7 +30,7 @@ export default {
if (!this.src) {
return;
}
let real_src = this.src.split(",")[0];
const real_src = this.src.split(',')[0];
if (isExternal(real_src)) {
return real_src;
}
@@ -45,9 +40,9 @@ export default {
if (!this.src) {
return;
}
let real_src_list = this.src.split(",");
let srcList = [];
real_src_list.forEach(item => {
const real_src_list = this.src.split(',');
const srcList = [];
real_src_list.forEach((item) => {
if (isExternal(item)) {
return srcList.push(item);
}
@@ -56,12 +51,12 @@ export default {
return srcList;
},
realWidth() {
return typeof this.width == "string" ? this.width : `${this.width}px`;
return typeof this.width == 'string' ? this.width : `${this.width}px`;
},
realHeight() {
return typeof this.height == "string" ? this.height : `${this.height}px`;
return typeof this.height == 'string' ? this.height : `${this.height}px`;
}
},
}
};
</script>