| | |
| | | |
| | | <script> |
| | | import { isExternal } from "@/utils/validate"; |
| | | |
| | | const DEFAULT_IMAGE = 'https://img2.baidu.com/it/u=68398439,1553004927&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=357'; |
| | | export default { |
| | | name: "ImagePreview", |
| | | props: { |
| | |
| | | }, |
| | | computed: { |
| | | realSrc() { |
| | | if (!this.src) { |
| | | return; |
| | | const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|svg)$/i; |
| | | if (!this.src || !imageExtensions.test(this.src)) { |
| | | return DEFAULT_IMAGE; |
| | | } |
| | | let real_src = this.src.split(",")[0]; |
| | | if (isExternal(real_src)) { |
| | |
| | | }, |
| | | realSrcList() { |
| | | if (!this.src) { |
| | | return; |
| | | return [DEFAULT_IMAGE]; |
| | | } |
| | | let real_src_list = this.src.split(","); |
| | | let srcList = []; |