Browse Source

Merge pull request #29 in DEC/decision-webui-dcm from ~ALAN/decision-webui-dcm:feature/10.0 to feature/10.0

* commit '036bc69364faf3738a1b15d035ff65df8434857a':
  feat: 无jira任务 当图片不存在时,显示默认图片
qufenxi
alan 5 years ago
parent
commit
7002fcbfbc
  1. 17
      src/modules/pages/database/database_type/database_type.ts

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

Loading…
Cancel
Save