Skip to content

Commit 03771ef

Browse files
committed
v3.8.4:修复图片预览组件src属性为null值控制台报错问题(I5KBAS)
1 parent b41948f commit 03771ef

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/ImagePreview/index.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default {
1919
props: {
2020
src: {
2121
type: String,
22-
required: true
22+
default: ""
2323
},
2424
width: {
2525
type: [Number, String],
@@ -32,13 +32,19 @@ export default {
3232
},
3333
computed: {
3434
realSrc() {
35+
if (!this.src) {
36+
return;
37+
}
3538
let real_src = this.src.split(",")[0];
3639
if (isExternal(real_src)) {
3740
return real_src;
3841
}
3942
return process.env.VUE_APP_BASE_API + real_src;
4043
},
4144
realSrcList() {
45+
if (!this.src) {
46+
return;
47+
}
4248
let real_src_list = this.src.split(",");
4349
let srcList = [];
4450
real_src_list.forEach(item => {

0 commit comments

Comments
 (0)