diff --git a/README.md b/README.md index 63e4a6b4c696071956a9654d8ddeb8f397dc27f0..5d5e0c7fb529898e2c75515396d07c61c3d5b83b 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')); + } ... ``` ## 接口说明