跳过网络,从内存中取图片,接口说明文档
Signed-off-by: ‘面条侠’ <‘wangxinxin51@h-partners.com’>
This commit is contained in:
parent
021a6e42f6
commit
4fba7e9191
|
@ -54,12 +54,7 @@ struct testImageKnifeCache {
|
||||||
placeholderSrc: $r('app.media.icon_loading'),
|
placeholderSrc: $r('app.media.icon_loading'),
|
||||||
errorholderSrc: $r('app.media.icon_failed')
|
errorholderSrc: $r('app.media.icon_failed')
|
||||||
};
|
};
|
||||||
|
loadSuccess = (data: ImageKnifeData) => {
|
||||||
hasUrlCache(url: string, cacheType: CacheType = CacheType.Default, size: Size = {
|
|
||||||
width: 0,
|
|
||||||
height: 0
|
|
||||||
}) {
|
|
||||||
imageKnife?.isUrlExist(url, cacheType, size).then((data: ImageKnifeData) => {
|
|
||||||
clearTimeout(this.timeId);
|
clearTimeout(this.timeId);
|
||||||
if (data.isPixelMap()) {
|
if (data.isPixelMap()) {
|
||||||
if (data.drawPixelMap) {
|
if (data.drawPixelMap) {
|
||||||
|
@ -101,10 +96,8 @@ struct testImageKnifeCache {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch((err: BusinessError) => {
|
}
|
||||||
|
loadError = (err: BusinessError) => {
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
|
@ -192,20 +185,19 @@ struct testImageKnifeCache {
|
||||||
Button('缓存图片')
|
Button('缓存图片')
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
this.index_ = 1;
|
this.index_ = 1;
|
||||||
this.hasUrlCache(this.url, CacheType.Cache, this.comSize);
|
imageKnife?.isUrlExist(this.url, CacheType.Cache, this.comSize);
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
Button('磁盘图片')
|
Button('磁盘图片')
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
this.index_ = 2;
|
this.index_ = 2;
|
||||||
this.hasUrlCache(this.url, CacheType.Disk, this.comSize);
|
imageKnife?.isUrlExist(this.url, CacheType.Disk, this.comSize);
|
||||||
})
|
})
|
||||||
|
|
||||||
Button('默认')
|
Button('默认')
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
this.index_ = 2;
|
this.index_ = 2;
|
||||||
this.hasUrlCache(this.url);
|
imageKnife?.isUrlExist(this.url);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue