Pre Merge pull request !264 from zgf/3.x
This commit is contained in:
commit
66de3e3ebd
|
@ -1,6 +1,7 @@
|
||||||
## 3.0.0-rc.5
|
## 3.0.0-rc.5
|
||||||
- 图片加载事件增加请求开始的回调,以及修复有缓存时,没有回调的bug
|
- 图片加载事件增加请求开始的回调,以及修复有缓存时,没有回调的bug
|
||||||
- 修复对已销毁组件不再下发请求的逻辑
|
- 修复对已销毁组件不再下发请求的逻辑
|
||||||
|
- Watch监听imageKnifeOption属性改为@State,对imageKnifeOption对象里面内容进行监听
|
||||||
|
|
||||||
## 3.0.0-rc.4
|
## 3.0.0-rc.4
|
||||||
- 支持hsp多包图片资源
|
- 支持hsp多包图片资源
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
{
|
{
|
||||||
"name": "default",
|
"name": "default",
|
||||||
"signingConfig": "default",
|
"signingConfig": "default",
|
||||||
"compileSdkVersion": "4.1.0(11)",
|
"compileSdkVersion": "5.0.0(12)",
|
||||||
"compatibleSdkVersion": "4.1.0(11)",
|
"compatibleSdkVersion": "5.0.0(12)",
|
||||||
"runtimeOS": "HarmonyOS",
|
"runtimeOS": "HarmonyOS",
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -23,42 +23,46 @@ export interface HeaderOptions {
|
||||||
}
|
}
|
||||||
@Observed
|
@Observed
|
||||||
export class ImageKnifeOption {
|
export class ImageKnifeOption {
|
||||||
|
@Track
|
||||||
// 主图资源
|
// 主图资源
|
||||||
loadSrc: string | PixelMap | Resource = "";
|
loadSrc: string | PixelMap | Resource = "";
|
||||||
// 占位图
|
// 占位图
|
||||||
placeholderSrc?: string | PixelMap | Resource;
|
placeholderSrc?: string | PixelMap | Resource;
|
||||||
// 失败占位图
|
// 失败占位图
|
||||||
errorholderSrc?: string | PixelMap | Resource;
|
errorholderSrc?: string | PixelMap | Resource;
|
||||||
|
@Track
|
||||||
headerOption?: Array<HeaderOptions>;
|
headerOption?: Array<HeaderOptions>;
|
||||||
|
@Track
|
||||||
// 自定义缓存关键字
|
// 自定义缓存关键字
|
||||||
signature?: string;
|
signature?: string;
|
||||||
|
@Track
|
||||||
// 主图填充效果
|
// 主图填充效果
|
||||||
objectFit?: ImageFit
|
objectFit?: ImageFit
|
||||||
|
@Track
|
||||||
// 占位图填充效果
|
// 占位图填充效果
|
||||||
placeholderObjectFit?: ImageFit
|
placeholderObjectFit?: ImageFit
|
||||||
|
@Track
|
||||||
// 错误图填充效果
|
// 错误图填充效果
|
||||||
errorholderObjectFit?: ImageFit
|
errorholderObjectFit?: ImageFit
|
||||||
|
@Track
|
||||||
customGetImage?: (context: Context, src: string | PixelMap | Resource) => Promise<ArrayBuffer | undefined>
|
customGetImage?: (context: Context, src: string | PixelMap | Resource) => Promise<ArrayBuffer | undefined>
|
||||||
|
@Track
|
||||||
border?: BorderOptions
|
border?: BorderOptions
|
||||||
// 缓存策略
|
// 缓存策略
|
||||||
|
@Track
|
||||||
writeCacheStrategy?: CacheStrategy
|
writeCacheStrategy?: CacheStrategy
|
||||||
// 仅使用缓存加载数据
|
// 仅使用缓存加载数据
|
||||||
|
@Track
|
||||||
onlyRetrieveFromCache?: boolean = false;
|
onlyRetrieveFromCache?: boolean = false;
|
||||||
|
@Track
|
||||||
priority? : taskpool.Priority = taskpool.Priority.LOW
|
priority? : taskpool.Priority = taskpool.Priority.LOW
|
||||||
|
@Track
|
||||||
context?: common.UIAbilityContext;
|
context?: common.UIAbilityContext;
|
||||||
|
@Track
|
||||||
progressListener?: (progress: number)=>void;
|
progressListener?: (progress: number)=>void;
|
||||||
|
@Track
|
||||||
transformation?: PixelMapTransformation
|
transformation?: PixelMapTransformation
|
||||||
|
@Track
|
||||||
onLoadListener?: OnLoadCallBack | undefined;
|
onLoadListener?: OnLoadCallBack | undefined;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
|
@ -21,7 +21,7 @@ import { ImageKnifeRequestSource } from '../model/ImageKnifeData';
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
export struct ImageKnifeComponent {
|
export struct ImageKnifeComponent {
|
||||||
@Watch('watchImageKnifeOption') @ObjectLink imageKnifeOption: ImageKnifeOption;
|
@Watch('watchImageKnifeOption') @State imageKnifeOption: ImageKnifeOption = new ImageKnifeOption();
|
||||||
@State pixelMap: PixelMap | string | undefined = undefined
|
@State pixelMap: PixelMap | string | undefined = undefined
|
||||||
@State adaptiveWidth: Length = '100%'
|
@State adaptiveWidth: Length = '100%'
|
||||||
@State adaptiveHeight: Length = '100%'
|
@State adaptiveHeight: Length = '100%'
|
||||||
|
@ -53,7 +53,15 @@ export struct ImageKnifeComponent {
|
||||||
this.request = undefined
|
this.request = undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
aboutToReuse(params: ESObject): void {
|
||||||
|
this.imageKnifeOption = params.imageKnifeOption
|
||||||
|
if (this.request !== undefined) {
|
||||||
|
this.request.requestState = ImageKnifeRequestState.DESTROY
|
||||||
|
}
|
||||||
|
this.request = undefined
|
||||||
|
this.componentVersion++
|
||||||
|
ImageKnife.getInstance().execute(this.getRequest(this.currentWidth, this.currentHeight))
|
||||||
|
}
|
||||||
aboutToRecycle() {
|
aboutToRecycle() {
|
||||||
if (this.request !== undefined) {
|
if (this.request !== undefined) {
|
||||||
this.request.requestState = ImageKnifeRequestState.DESTROY
|
this.request.requestState = ImageKnifeRequestState.DESTROY
|
||||||
|
@ -90,7 +98,6 @@ export struct ImageKnifeComponent {
|
||||||
this.request.requestState = ImageKnifeRequestState.DESTROY
|
this.request.requestState = ImageKnifeRequestState.DESTROY
|
||||||
}
|
}
|
||||||
this.request = undefined
|
this.request = undefined
|
||||||
this.componentVersion++
|
|
||||||
ImageKnife.getInstance().execute(this.getRequest(this.currentWidth, this.currentHeight))
|
ImageKnife.getInstance().execute(this.getRequest(this.currentWidth, this.currentHeight))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue