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 | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/src/components/subComponents/ImageShow.vue b/src/components/subComponents/ImageShow.vue
index 5aac2f0..3285ef7 100644
--- a/src/components/subComponents/ImageShow.vue
+++ b/src/components/subComponents/ImageShow.vue
@@ -1,5 +1,5 @@
<template>
- <img class="a111" :src="url" alt="" />
+ <img class="a111" @error="onError" :src="url" alt="" />
</template>
<script>
@@ -20,6 +20,21 @@
}
},
},
+ 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