修改onLoadCancel回调demo及其缓存中获取图片的格式大小信息

Signed-off-by: tyBrave <tianyong21@h-partners.com>
This commit is contained in:
tyBrave 2024-10-16 15:56:42 +08:00
parent 1027fc0304
commit e31c592ee4
2 changed files with 7 additions and 5 deletions

View File

@ -79,7 +79,9 @@ struct LoadStatePage {
}) })
} }
.margin({ top: 20 }) .margin({ top: 20 })
Text(this.typeValue) Text("格式:"+this.typeValue)
Text("宽度:"+this.currentWidth)
Text("高度:"+this.currentHeight)
ImageKnifeComponent({ imageKnifeOption: this.ImageKnifeOption }).height(this.currentHeight).width(this.currentWidth) ImageKnifeComponent({ imageKnifeOption: this.ImageKnifeOption }).height(this.currentHeight).width(this.currentWidth)
.margin({ top: 20 }) .margin({ top: 20 })
Button($r('app.string.Custom_download_failed')).onClick(()=>{ Button($r('app.string.Custom_download_failed')).onClick(()=>{

View File

@ -38,10 +38,10 @@ struct TestLoadCancelListenerPage {
loadSrc: "https://q7.itc.cn/images01/20240223/ce80229bf9934dff97cdf2ad7be1dcb8.jpeg", loadSrc: "https://q7.itc.cn/images01/20240223/ce80229bf9934dff97cdf2ad7be1dcb8.jpeg",
objectFit: ImageFit.Contain, objectFit: ImageFit.Contain,
onLoadListener: { onLoadListener: {
onLoadStart: (data) => { onLoadStart: () => {
this.showChild = false; this.showChild = false;
}, },
onLoadCancel: (res, data) => { onLoadCancel: (res) => {
this.text = "onLoadCancel回调成功网络nLoadCancel回调原因:" + res this.text = "onLoadCancel回调成功网络nLoadCancel回调原因:" + res
console.log("TestLoadCancelListenerPage----onLoadCancel> url:" + res) console.log("TestLoadCancelListenerPage----onLoadCancel> url:" + res)
} }
@ -66,10 +66,10 @@ struct TestLoadCancelListenerPage {
loadSrc: $r('app.media.loading'), loadSrc: $r('app.media.loading'),
objectFit: ImageFit.Contain, objectFit: ImageFit.Contain,
onLoadListener: { onLoadListener: {
onLoadStart: (data) => { onLoadStart: () => {
this.showChild = false; this.showChild = false;
}, },
onLoadCancel: (res, data) => { onLoadCancel: (res) => {
this.text = "onLoadCancel回调成功本地onLoadCancel回调原因:" + res this.text = "onLoadCancel回调成功本地onLoadCancel回调原因:" + res
console.log("TestLoadCancelListenerPage----onLoadCancel> url:" + res) console.log("TestLoadCancelListenerPage----onLoadCancel> url:" + res)
} }