chenjun3_wd

图片下载模块

@@ -7,10 +7,14 @@ import { photoAccessHelper } from '@kit.MediaLibraryKit'; @@ -7,10 +7,14 @@ import { photoAccessHelper } from '@kit.MediaLibraryKit';
7 import fs from '@ohos.file.fs'; 7 import fs from '@ohos.file.fs';
8 8
9 const PERMISSIONS: Array<Permissions> = [ 9 const PERMISSIONS: Array<Permissions> = [
10 - 'ohos.permission.READ_MEDIA',  
11 - 'ohos.permission.WRITE_MEDIA' 10 + 'ohos.permission.READ_IMAGEVIDEO',
  11 + 'ohos.permission.WRITE_IMAGEVIDEO'
12 ]; 12 ];
13 13
  14 +/*
  15 + * saveButton参考文档
  16 + * https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/savebutton-0000001820999677
  17 + * */
14 @Component 18 @Component
15 export struct ImageDownloadComponent { 19 export struct ImageDownloadComponent {
16 @State image: PixelMap | undefined = undefined; 20 @State image: PixelMap | undefined = undefined;
@@ -20,12 +24,8 @@ export struct ImageDownloadComponent { @@ -20,12 +24,8 @@ export struct ImageDownloadComponent {
20 24
21 build() { 25 build() {
22 Column() { 26 Column() {
23 - Image($r('app.media.icon_arrow_left_white'))  
24 - .width(24)  
25 - .height(24)  
26 - .aspectRatio(1)  
27 - .interpolation(ImageInterpolation.High)  
28 - .rotate({ angle: -90 }) 27 + SaveButton({ icon: SaveIconStyle.LINES })
  28 + .iconColor(Color.White)
29 .onClick(async () => { 29 .onClick(async () => {
30 console.info(`cj2024 onClick ${this.imageBuffer}`) 30 console.info(`cj2024 onClick ${this.imageBuffer}`)
31 if (this.imageBuffer !== undefined) { 31 if (this.imageBuffer !== undefined) {