From 1fe240406526b9b6256664559d3d2bec9250135c Mon Sep 17 00:00:00 2001
From: mark <mark18340872469@163.com>
Date: 星期五, 21 十月 2022 18:38:53 +0800
Subject: [PATCH] 设备管理小样
---
src/components/subComponents/ImageShow.vue | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/src/components/subComponents/ImageShow.vue b/src/components/subComponents/ImageShow.vue
index c22e128..3285ef7 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,32 @@
},
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
+ ) {
+ 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