增加加载长图片样例

Signed-off-by: zenggaofeng <zenggaofeng2@h-partners.com>
This commit is contained in:
zenggaofeng 2023-12-06 11:36:34 +08:00
parent 89fcb3a5d3
commit 19eff8129f
4 changed files with 38 additions and 1 deletions

View File

@ -285,6 +285,10 @@ struct IndexFunctionDemo {
.onClick(() => {
router.pushUrl({ url: "pages/testManyGifLoadWithPage" });
}).margin({ top: 5, left: 3 })
Button("测试加载长图")
.onClick(() => {
router.pushUrl({ url: "pages/longImageKnifeTestPage" });
}).margin({ top: 5, left: 3 })
}.width('100%').height(60).backgroundColor(Color.Pink)
}
}

View File

@ -0,0 +1,32 @@
/*
* Copyright (C) 2023 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 { ImageKnifeComponent } from '@ohos/imageknife'
@Entry
@Component
struct LongImageKnifeTestPage {
build(){
Scroll(){
ImageKnifeComponent({imageKnifeOption:{
loadSrc:$r('app.media.long_pic')
}}).size({
width:356,
height:3124.90666666668
}).backgroundColor(Color.Pink)
}.width('100%').height('100%')
.scrollable(ScrollDirection.Vertical)
.scrollBar(BarState.Auto)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

View File

@ -33,6 +33,7 @@
"pages/SignatureTestPage",
"pages/hspCacheTestPage",
"pages/testManyNetImageLoadWithPage",
"pages/testManyGifLoadWithPage"
"pages/testManyGifLoadWithPage",
"pages/longImageKnifeTestPage"
]
}