From 0f8be5eece9ec8a8a03dc7d4e4b3231e4dc4ebb6 Mon Sep 17 00:00:00 2001 From: mark <mark18340872469@163.com> Date: 星期三, 28 九月 2022 16:19:07 +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