diff --git a/README.md b/README.md index 459d1ba..5d15af9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# GlideJS +# ImageKnife **专门为OpenHarmony打造的一款图像加载缓存库,致力于更高效、更轻便、更简单** @@ -15,7 +15,7 @@ ``` /entry/src/ -- main/ets/default +- main/ets/MainAbility - cache # 缓存相关内容 - diskstrategy # 缓存策略 - key # 缓存key生成策略 @@ -224,10 +224,16 @@ struct Index { ##### 步骤1: -定义一个入参 PixelMap +定义自定义类 +export default class PixelMapPack{ + + pixelMap:PixelMap; + +} +使用@State关联PixelMapPack ```typescript -@State tomatoPixelMap:PixelMap = new PixelMap(); +@State glidePixelMapPack:PixelMapPack = new PixelMapPack(); width:number = 200; height:number = 200; ``` @@ -237,7 +243,7 @@ height:number = 200; 在你的component组件中,写下一个Image组件,将基础参数(入参PixelMap,组件的宽、高)配置好 ``` -Image(this.tomatoPixelMap) +Image(this.glidePixelMapPack.pixelMap) .backgroundColor(Color.Grey) .objectFit(ImageFit.Contain) .width(this.width) diff --git a/entry/src/main/ets/MainAbility/workers/worker1.js b/entry/src/main/ets/MainAbility/workers/worker1.js index 8acdf98..f692c34 100644 --- a/entry/src/main/ets/MainAbility/workers/worker1.js +++ b/entry/src/main/ets/MainAbility/workers/worker1.js @@ -1,9 +1,19 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ import arkWorker from '@ohos.worker'; -function foo(x) { - return x -} - arkWorker.parentPort.onmessage = function (e) { var data = e.data; switch (data.type) {