| | |
| | | <template> |
| | | <img :src="url" alt="" /> |
| | | <img class="a111" @error="onError" :src="url" alt="" /> |
| | | </template> |
| | | |
| | | <script> |
| | |
| | | }, |
| | | 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> |
| | | |