From f20a554bdb24e9dfde9dc6a69d78595944f61d15 Mon Sep 17 00:00:00 2001 From: mark <mark18340872469@163.com> Date: 星期二, 25 十月 2022 14:53:57 +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