From 3d95e04bf544177c9e847a96d903f9596b4f2cfa Mon Sep 17 00:00:00 2001
From: ZZJ <10913410+zzj2100@user.noreply.gitee.com>
Date: 星期二, 02 八月 2022 19:52:48 +0800
Subject: [PATCH] 山东最新版本
---
src/components/subComponents/ImageShow.vue | 26 +++++++++++++++++++++++---
1 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/src/components/subComponents/ImageShow.vue b/src/components/subComponents/ImageShow.vue
index c22e128..a0484a7 100644
--- a/src/components/subComponents/ImageShow.vue
+++ b/src/components/subComponents/ImageShow.vue
@@ -1,5 +1,5 @@
<template>
- <img :src="url" alt="" />
+ <img class="a111" @error="onError" :src="url" alt="" />
</template>
<script>
@@ -9,13 +9,33 @@
},
computed: {
url() {
- if (this.src.indexOf("http://apps.smartai.com/httpImage/") === -1) {
- return "httpImage" + this.src;
+ if (
+ this.src &&
+ this.src.indexOf("http://apps.smartai.com/httpImage/") === -1 &&
+ this.src.indexOf("/images") !== 0 &&
+ this.src.indexOf("/files") !== 0
+ ) {
+ return "/httpImage/" + this.src;
} else {
return this.src;
}
},
},
+ data() {
+ return {
+ errorNum: 0,
+ };
+ },
+ methods: {
+ onError(err) {
+ console.log(err);
+ if (this.errorNum > 5) {
+ return;
+ }
+ err.target.src = this.url + "?" + Math.random();
+ this.errorNum++;
+ },
+ },
};
</script>
--
Gitblit v1.8.0