web: fix image loading error

Signed-off-by: 田梓萱 <tianzixuan@bixin.cn>
This commit is contained in:
田梓萱 2023-10-27 10:14:01 +08:00
parent b42dd438f0
commit cc8976eefe
No known key found for this signature in database
GPG Key ID: 0B465732141CC7FD
3 changed files with 104 additions and 79 deletions

View File

@ -7436,12 +7436,19 @@ var doric_web = (function (exports, axios, sandbox) {
v.style.filter = '';
}
break;
case 'hidden':
super.blendProps(v, propName, prop);
if (prop == true) {
this.loadIntoTarget(v, '');
}
break;
default:
super.blendProps(v, propName, prop);
break;
}
}
loadIntoTarget(targetElement, src) {
if (src) {
this.clearStretchElementAttributes(targetElement);
this.loadPlaceHolder(targetElement);
let tempLoadElement = this.stretchInset ? document.createElement('img') : targetElement;
@ -7485,6 +7492,12 @@ var doric_web = (function (exports, axios, sandbox) {
}
});
}
else {
this.clearStretchElementAttributes(targetElement);
targetElement.style.display = 'none';
return;
}
}
loadImageWithStretch(v, src, stretchInset) {
v.src = transparentBase64;
v.style.borderImageSource = `url(${src})`;

File diff suppressed because one or more lines are too long

View File

@ -89,6 +89,12 @@ export class DoricImageNode extends DoricViewNode {
v.style.filter = ''
}
break
case 'hidden':
super.blendProps(v, propName, prop);
if (prop == true) {
this.loadIntoTarget(v, '');
}
break;
default:
super.blendProps(v, propName, prop)
break
@ -96,6 +102,7 @@ export class DoricImageNode extends DoricViewNode {
}
private loadIntoTarget(targetElement: HTMLImageElement, src: any) {
if (src) {
this.clearStretchElementAttributes(targetElement)
this.loadPlaceHolder(targetElement)
let tempLoadElement = this.stretchInset ? document.createElement('img') : targetElement
@ -136,6 +143,11 @@ export class DoricImageNode extends DoricViewNode {
this.loadImageWithStretch(targetElement, src, this.stretchInset)
}
})
} else {
this.clearStretchElementAttributes(targetElement)
targetElement.style.display = 'none';
return;
}
}
private loadImageWithStretch(v: HTMLImageElement, src: any, stretchInset: StretchInset) {