imageKnife header请求头编译报错修改合入
This commit is contained in:
parent
39d76ad37f
commit
a7909f84fe
|
@ -13,12 +13,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
import router from '@ohos.router';
|
||||
import { HeaderOption } from '@ohos/imageKnife/src/main/ets/components/imageKnife/ImageKnifeOption';
|
||||
import {
|
||||
ImageKnifeComponent,
|
||||
ImageKnifeOption,
|
||||
ImageKnifeGlobal,
|
||||
ImageKnife
|
||||
ImageKnife,
|
||||
HeaderOptions
|
||||
} from '@ohos/libraryimageknife'
|
||||
|
||||
import { ObjectKey } from '@ohos/libraryimageknife';
|
||||
|
@ -28,12 +28,12 @@ import { ObjectKey } from '@ohos/libraryimageknife';
|
|||
struct IndexFunctionDemo {
|
||||
@State headerOptions: HeaderOptions = {
|
||||
key: 'aaa',
|
||||
values: '单个image组件调用'
|
||||
value: '单个image组件调用'
|
||||
};
|
||||
|
||||
@State headerOptions1: HeaderOptions = {
|
||||
key: 'bbb',
|
||||
values: '单个image组件调用1'
|
||||
value: '单个image组件调用1'
|
||||
};
|
||||
|
||||
@State imageKnifeOption1: ImageKnifeOption =
|
||||
|
|
|
@ -14,11 +14,10 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
HeaderOptions,ImageKnife,ImageKnifeComponent,ImageKnifeData,ImageKnifeGlobal,RequestOption
|
||||
HeaderOptions,ImageKnife,ImageKnifeComponent,ImageKnifeData,ImageKnifeGlobal,RequestOption,ImageKnifeOption
|
||||
} from '@ohos/libraryimageknife'
|
||||
import { ImageKnifeOption } from '@ohos/libraryimageknife'
|
||||
import { image } from '@kit.ImageKit'
|
||||
import { BusinessError } from '@kit.BasicServiceKit'
|
||||
import { image } from '@ohos.multimedia.image'
|
||||
import { BusinessError } from '@ohos.base'
|
||||
|
||||
const TAG = "TEST-"
|
||||
let timeId = -1
|
||||
|
@ -26,23 +25,23 @@ let timeId = -1
|
|||
@Entry
|
||||
@Component
|
||||
struct testImageKnifeHttpRequestHeader {
|
||||
@State pixelMap: PixelMap | underfined = underfined;
|
||||
@State pixelMap: PixelMap | undefined = undefined;
|
||||
@State message: string = "图片header属性测试";
|
||||
//单个组件多个请求头调用,对应下面以组件形式调用
|
||||
@State headerOptions: headerOptions = {
|
||||
@State headerOptions: HeaderOptions = {
|
||||
key: "aaa",
|
||||
values: "单张imageKnife组件调用"
|
||||
};
|
||||
@State headerOptions1: headerOptions = {
|
||||
@State headerOptions1: HeaderOptions = {
|
||||
key: "bbb",
|
||||
values: "单张imageKnife组件调用1"
|
||||
};
|
||||
@State imageKnifeOption1: imageKnifeOption =
|
||||
@State imageKnifeOption1: ImageKnifeOption =
|
||||
{
|
||||
loadSrc: '图片网络地址',
|
||||
placeholderSrc: $r('app.media.icon_loading'),
|
||||
errorholderSrc: $r('app.media.icon_failed'),
|
||||
headerOption: [this.headerOptions, this.headerOption1]
|
||||
headerOption: [this.headerOptions, this.headerOptions1]
|
||||
};
|
||||
|
||||
// RequestOption调用
|
||||
|
@ -117,8 +116,8 @@ struct testImageKnifeHttpRequestHeader {
|
|||
}
|
||||
// RequestOptiom形式image显示
|
||||
ImageKnifeComponent({
|
||||
inageKnifeOption: {
|
||||
LoadSrc: this.pixelMap as inage.PixelMap
|
||||
imageKnifeOption: {
|
||||
loadSrc: this.pixelMap as image.PixelMap
|
||||
}
|
||||
}).width(200).height(200).borderWidth(1)
|
||||
// 单个组件形式image显示
|
||||
|
@ -129,6 +128,6 @@ struct testImageKnifeHttpRequestHeader {
|
|||
}
|
||||
.width("100%")
|
||||
.height("100%")
|
||||
.justifyContent(FLexAlign.Center)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ export class ImageKnife {
|
|||
resourceFetch: IResourceFetch<ArrayBuffer>;
|
||||
filesPath: string = ""; // data/data/包名/files目录
|
||||
|
||||
headerMap: Map<String, String> = new Map<String, String>(); //定义全局map
|
||||
headerMap: Map<string, string> = new Map<string, string>(); //定义全局map
|
||||
placeholderCache: string = "placeholderCache"
|
||||
runningMaps: EasyLinkedHashMap<string, RequestOption>;
|
||||
pendingMaps: EasyLinkedHashMap<string, RequestOption>;
|
||||
|
|
|
@ -223,10 +223,10 @@ export struct ImageKnifeComponent {
|
|||
|
||||
configDisplay(request: RequestOption) {
|
||||
//单个image组件多个请求头调用
|
||||
if (this.imageKnifeOption.headerOption != underfined && this.imageKnifeOption.headerOption?.length > 0) {
|
||||
if (this.imageKnifeOption.headerOption != undefined && this.imageKnifeOption.headerOption?.length > 0) {
|
||||
for (let i = 0; i < this.imageKnifeOption.headerOption.length; i++) {
|
||||
let headerOptions = this.imageKnifeOption.headerOption[i];
|
||||
request.addHeader(headerOptions.key, headerOptions.values);
|
||||
request.addHeader(headerOptions.key, headerOptions.value);
|
||||
}
|
||||
console.log('wxxx 999:' + JSON.stringify(this.imageKnifeOption.headerOption.length));
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ export interface TransformOptions{
|
|||
|
||||
export interface HeaderOptions {
|
||||
key: string;
|
||||
values: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
@Observed
|
||||
|
|
Loading…
Reference in New Issue