ImageKnife提供图片加载成功失败的事件README补充

Signed-off-by: 任伟x <renwei79@h-partners.com>
This commit is contained in:
任伟x 2024-05-27 16:24:19 +08:00
parent 2b5d0d3f0c
commit 27094f0db9
1 changed files with 23 additions and 0 deletions

View File

@ -148,6 +148,29 @@ ImageKnifeComponent({ ImageKnifeOption:
}).width(100).height(100)
```
#### 8.监听图片加载成功与失败
```
ImageKnifeComponent({ ImageKnifeOption:
{
loadSrc: $r("app.media.rabbit"),
onLoadListener:{
onLoadStart:()=>{
this.starTime = new Date().getTime()
console.info("Load start: ");
},
onLoadFailed: (err) => {
console.error("Load Failed Reason: " + err + " cost " + (new Date().getTime() - this.starTime) + " milliseconds");
},
onLoadSuccess: (data) => {
console.info("Load Successful: cost " + (new Date().getTime() - this.starTime) + " milliseconds");
return data;
},
}
}
}).width(100).height(100)
```
## 接口说明
### ImageKnifeOption参数列表