1.clean library contain photos , use user configs

Signed-off-by: dodozhou7 <abczp777777@163.com>
This commit is contained in:
dodozhou7 2022-08-17 20:49:24 -07:00
parent 9f22cf8066
commit 0cad9c86ab
2 changed files with 10 additions and 2 deletions

View File

@ -23,7 +23,7 @@ import {PixelMapPack} from '../imageknife/PixelMapPack'
export struct ImageKnifeComponent { export struct ImageKnifeComponent {
@Watch('watchImageKnifeOption') @Link imageKnifeOption: ImageKnifeOption; @Watch('watchImageKnifeOption') @Link imageKnifeOption: ImageKnifeOption;
@State imageKnifePixelMapPack: PixelMapPack = new PixelMapPack(); @State imageKnifePixelMapPack: PixelMapPack = new PixelMapPack();
@State imageKnifeResource: Resource = $r('app.media.icon_loading') @State imageKnifeResource: Resource = undefined
@State imageKnifeString: string = '' @State imageKnifeString: string = ''
@State normalPixelMap: boolean = false; @State normalPixelMap: boolean = false;
@State normalResource: boolean = true; @State normalResource: boolean = true;
@ -40,6 +40,8 @@ export struct ImageKnifeComponent {
@State imageWidth: string = '100%'; @State imageWidth: string = '100%';
@State imageHeight: string = '100%'; @State imageHeight: string = '100%';
@State imageKnifeRetry: Resource = undefined;
hasRetry:boolean = false; hasRetry:boolean = false;
build() { build() {
@ -52,7 +54,7 @@ export struct ImageKnifeComponent {
.width(this.percentWidth) .width(this.percentWidth)
.height(this.percentHeight) .height(this.percentHeight)
Image($r('app.media.icon_retry')) Image(this.imageKnifeRetry)
.onClick(()=>{ .onClick(()=>{
this.retryClick(); this.retryClick();
}) })
@ -144,6 +146,9 @@ export struct ImageKnifeComponent {
this.animateTo('image'); this.animateTo('image');
}) })
} }
if (this.imageKnifeOption.retryholderSrc) {
this.imageKnifeRetry = this.imageKnifeOption.retryholderSrc
}
if (this.imageKnifeOption.transform) { if (this.imageKnifeOption.transform) {
this.requestAddTransform(request) this.requestAddTransform(request)
} }

View File

@ -37,6 +37,9 @@ export class ImageKnifeOption {
// 失败占位图 // 失败占位图
errorholderSrc?: PixelMap | Resource; errorholderSrc?: PixelMap | Resource;
// 重试占位图
retryholderSrc?: Resource;
// 缩略图,范围(0,1) // 缩略图,范围(0,1)
thumbSizeMultiplier?: number; thumbSizeMultiplier?: number;