Compare commits

...
This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.

1 Commits

Author SHA1 Message Date
田梓萱
cc8976eefe
web: fix image loading error
Signed-off-by: 田梓萱 <tianzixuan@bixin.cn>
2023-10-27 10:29:39 +08:00
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 = ''; v.style.filter = '';
} }
break; break;
case 'hidden':
super.blendProps(v, propName, prop);
if (prop == true) {
this.loadIntoTarget(v, '');
}
break;
default: default:
super.blendProps(v, propName, prop); super.blendProps(v, propName, prop);
break; break;
} }
} }
loadIntoTarget(targetElement, src) { loadIntoTarget(targetElement, src) {
if (src) {
this.clearStretchElementAttributes(targetElement); this.clearStretchElementAttributes(targetElement);
this.loadPlaceHolder(targetElement); this.loadPlaceHolder(targetElement);
let tempLoadElement = this.stretchInset ? document.createElement('img') : 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) { loadImageWithStretch(v, src, stretchInset) {
v.src = transparentBase64; v.src = transparentBase64;
v.style.borderImageSource = `url(${src})`; 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 = '' v.style.filter = ''
} }
break break
case 'hidden':
super.blendProps(v, propName, prop);
if (prop == true) {
this.loadIntoTarget(v, '');
}
break;
default: default:
super.blendProps(v, propName, prop) super.blendProps(v, propName, prop)
break break
@ -96,6 +102,7 @@ export class DoricImageNode extends DoricViewNode {
} }
private loadIntoTarget(targetElement: HTMLImageElement, src: any) { private loadIntoTarget(targetElement: HTMLImageElement, src: any) {
if (src) {
this.clearStretchElementAttributes(targetElement) this.clearStretchElementAttributes(targetElement)
this.loadPlaceHolder(targetElement) this.loadPlaceHolder(targetElement)
let tempLoadElement = this.stretchInset ? document.createElement('img') : targetElement let tempLoadElement = this.stretchInset ? document.createElement('img') : targetElement
@ -136,6 +143,11 @@ export class DoricImageNode extends DoricViewNode {
this.loadImageWithStretch(targetElement, src, this.stretchInset) this.loadImageWithStretch(targetElement, src, this.stretchInset)
} }
}) })
} else {
this.clearStretchElementAttributes(targetElement)
targetElement.style.display = 'none';
return;
}
} }
private loadImageWithStretch(v: HTMLImageElement, src: any, stretchInset: StretchInset) { private loadImageWithStretch(v: HTMLImageElement, src: any, stretchInset: StretchInset) {