From e512dc4df442ada2ec43d3c274a218a7c3128ca9 Mon Sep 17 00:00:00 2001 From: wangyingjun02 <2959448004@qq.com> Date: Fri, 28 Apr 2023 09:16:41 +0800 Subject: [PATCH] =?UTF-8?q?update=20readme=E9=87=8C=E7=9A=84=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangyingjun02 <2959448004@qq.com> --- README.md | 73 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 63e4a6b..5d5e0c7 100644 --- a/README.md +++ b/README.md @@ -25,14 +25,73 @@ OpenHarmony ohpm 环境配置等更多内容,请参考[如何安装 OpenHarmon ... //创建model对象 @State model: SubsamplingScaleImageView.Model = new SubsamplingScaleImageView.Model() - - //设置图片源 - private aboutToAppear() { - this.model.setImage($r('app.media.sanmartino')); - } ... - //使用SubsamplingScaleImageView组件 - SubsamplingScaleImageView({ model: this.model }) + build() { + Stack({ alignContent: Alignment.Bottom }) { + //使用SubsamplingScaleImageView组件 + SubsamplingScaleImageView({ model: this.model }) + Column({ space: 5 }) { + Swiper(this.swiperController) { + Row({ space: 5 }) { + Text('This image is 7,800 x 6,240 pixels. On most devices it will be subsampled, and higher quality tiles are loaded as you zoom in.') + .width('100%') + .height(60) + .layoutWeight(1) + .fontColor(0xffffff) + .textAlign(TextAlign.Center) + .fontSize(16) + Image($r('app.media.next')) + .width(30) + .height(30) + .margin({ top: 6, left: 10 }) + .onClick((event: ClickEvent) => { + this.index = 1; + + }) + }.width('100%').height(60).backgroundColor(0x3d3d3d) + + Row({ space: 5 }) { + Image($r('app.media.previous')).width(30).height(30).margin({ top: 6 }).onClick((event: ClickEvent) => { + this.index = 0; + }) + Text('This image has been rotated 90 degrees. Tap the button to rotate it. EXIF rotation is supported for external files.') + .width('100%') + .height(60) + .layoutWeight(1) + .fontColor(0xffffff) + .textAlign(TextAlign.Center) + .fontSize(16) + Image($r('app.media.rotate')) + .width(30) + .height(30) + .margin({ top: 6, left: 10, right: 20 }) + .onClick((event: ClickEvent) => { + this.mRotate += 90; + this.model.setOrientation(this.mRotate) + }) + }.width('100%').height(60).backgroundColor(0x3d3d3d) + + } + .index(this.index) + .autoPlay(false) + .indicator(false) // 默认开启指示点 + .loop(false) // 默认开启循环播放 + .duration(50) + .vertical(false) // 默认横向切换 + .itemSpace(0) + .onChange((index: number) => { + if (index == 1) { + + this.model.setImage($r('app.media.swissroad')); + } + }) + }.height(60).backgroundColor(0x3d3d3d).align(Alignment.Bottom) + } + } + //设置图片源 + aboutToAppear() { + this.model.setImage($r('app.media.card')); + } ... ``` ## 接口说明 -- Gitee