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

Merge pull request !287 from 任伟x/master
This commit is contained in:
openharmony_ci 2024-05-27 09:31:50 +00:00 committed by Gitee
commit f7bb2f1999
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 17 additions and 0 deletions

View File

@ -144,6 +144,23 @@ async function custom(context: Context, src: string): Promise<ArrayBuffer | unde
ImageKnifeGlobal.getInstance().getImageKnife()?.replaceDataFetch(new CustomDataFetchClient()); ImageKnifeGlobal.getInstance().getImageKnife()?.replaceDataFetch(new CustomDataFetchClient());
``` ```
### 8.监听图片加载成功与失败
```
ImageKnifeNextComponent({
imageKnifeNextOption: {
loadSrc: 'http://e.hiphotos.baidu.com/image/pic/item/4e4a20a4462309f7e41f5cfe760e0cf3d6cad6ee.jpg',
onLoadListener: {
console.log('Load Successful: ' + data);
return data;
},
onLoadFailed: (err) => {
console.error('Load Failed Reason: ' + err);
}
}
}
}).width(100).height(100)
```
## 进阶使用 ## 进阶使用
如果简单的加载一张图像无法满足需求我们可以看看ImageKnifeOption这个类提供了哪些扩展能力。 如果简单的加载一张图像无法满足需求我们可以看看ImageKnifeOption这个类提供了哪些扩展能力。