diff --git a/entry/src/main/ets/pages/TestPrefetchToFileCache.ets b/entry/src/main/ets/pages/TestPrefetchToFileCache.ets index d6b9e23..eb735a7 100644 --- a/entry/src/main/ets/pages/TestPrefetchToFileCache.ets +++ b/entry/src/main/ets/pages/TestPrefetchToFileCache.ets @@ -26,11 +26,18 @@ struct TestPrefetchToFileCachePage { let fileCachePath = await ImageKnife.getInstance().preLoadCache(url) console.log("preload-fileCachePath=="+ fileCachePath) } + async preload1(url:string) { + let fileCachePath = await ImageKnife.getInstance().preLoadCache({ loadSrc: url }) + console.log("preload-fileCachePath1=="+ fileCachePath) + } build() { Column() { - Button("预加载图片到文件缓存").margin({top:10}).onClick(async ()=>{ + Button("url预加载图片到文件缓存").margin({top:10}).onClick(async ()=>{ await this.preload("https://gd-hbimg.huaban.com/e0a25a7cab0d7c2431978726971d61720732728a315ae-57EskW_fw658") }) + Button("option预加载图片到文件缓存").margin({top:10}).onClick(async ()=>{ + await this.preload1("https://gd-hbimg.huaban.com/e0a25a7cab0d7c2431978726971d61720732728a315ae-57EskW_fw658") + }) Button("加载图片(预加载后可断网加载)").margin({top:10}).onClick(()=>{ this.imageKnifeOption.loadSrc = "https://gd-hbimg.huaban.com/e0a25a7cab0d7c2431978726971d61720732728a315ae-57EskW_fw658" })