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`); + }; + } }