From 65089091ec736a23240051bace1abc0d338f08ee Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Sat, 21 Dec 2019 18:13:46 +0800 Subject: [PATCH] add onLoad callback --- src/shader/DoricImageNode.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/shader/DoricImageNode.ts b/src/shader/DoricImageNode.ts index 96b84991..c1296f3c 100644 --- a/src/shader/DoricImageNode.ts +++ b/src/shader/DoricImageNode.ts @@ -5,7 +5,7 @@ export class DoricImageNode extends DoricViewNode { return document.createElement('img') } - blendProps(v: HTMLParagraphElement, propName: string, prop: any) { + blendProps(v: HTMLImageElement, propName: string, prop: any) { switch (propName) { case 'imageUrl': v.setAttribute('src', prop) @@ -15,7 +15,10 @@ export class DoricImageNode extends DoricViewNode { break case 'loadCallback': v.onload = () => { - this.callJSResponse(prop) + this.callJSResponse(prop, { + width: v.width, + height: v.height + }) } break default: