From 036bc69364faf3738a1b15d035ff65df8434857a Mon Sep 17 00:00:00 2001 From: alan Date: Fri, 30 Aug 2019 11:47:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=97=A0jira=E4=BB=BB=E5=8A=A1=20?= =?UTF-8?q?=E5=BD=93=E5=9B=BE=E7=89=87=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=98=BE=E7=A4=BA=E9=BB=98=E8=AE=A4=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../database/database_type/database_type.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/modules/pages/database/database_type/database_type.ts b/src/modules/pages/database/database_type/database_type.ts index d528c05..a14e477 100644 --- a/src/modules/pages/database/database_type/database_type.ts +++ b/src/modules/pages/database/database_type/database_type.ts @@ -20,6 +20,8 @@ export class DatebaseType extends BI.BasicButton { baseCls: 'dec-dcm-datebase-type', } + img: any; + store: DatebaseTypeModel['store']; render() { @@ -37,6 +39,9 @@ export class DatebaseType extends BI.BasicButton { el: { type: Img, src: iconUrl ? iconUrl : `${ImgPrefix}${databaseType}.jpg`, + ref: (_ref: any) => { + this.img = _ref; + }, }, height: 90, }, @@ -62,4 +67,16 @@ export class DatebaseType extends BI.BasicButton { const { value } = this.options; this.store.setDatebaseTypeSelected(value); } + + mounted() { + this.setDefaultImg(); + } + + private setDefaultImg() { + const ImgObj = new Image(); + ImgObj.src = this.img.getSrc(); + ImgObj.onerror = () => { + this.img.setSrc(`${ImgPrefix}other.jpg`); + }; + } }