add onLoad callback

This commit is contained in:
pengfei.zhou 2019-12-21 18:13:46 +08:00
parent 0ac97353f2
commit 65089091ec

View File

@ -5,7 +5,7 @@ export class DoricImageNode extends DoricViewNode {
return document.createElement('img') return document.createElement('img')
} }
blendProps(v: HTMLParagraphElement, propName: string, prop: any) { blendProps(v: HTMLImageElement, propName: string, prop: any) {
switch (propName) { switch (propName) {
case 'imageUrl': case 'imageUrl':
v.setAttribute('src', prop) v.setAttribute('src', prop)
@ -15,7 +15,10 @@ export class DoricImageNode extends DoricViewNode {
break break
case 'loadCallback': case 'loadCallback':
v.onload = () => { v.onload = () => {
this.callJSResponse(prop) this.callJSResponse(prop, {
width: v.width,
height: v.height
})
} }
break break
default: default: