HarmonyOS 无法使用@ohos.file.AlbumPickerComponent (Album Picker组件)

HarmonyOS
1天前
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
zxjiu

参考以下示例修改:

import {
  AlbumPickerComponent,
  AlbumPickerOptions,
  AlbumInfo
} from '@ohos.file.AlbumPickerComponent';
import { PickerColorMode } from '@ohos.file.PhotoPickerComponent';

@Entry
@Component
struct AlbumPickerPage {
  @State message: string = 'Hello World';
  albumPickerOptions: AlbumPickerOptions = new AlbumPickerOptions();

  aboutToAppear() {
    this.albumPickerOptions.themeColorMode = PickerColorMode.AUTO;
  }

  private onAlbumClick(albumInfo: AlbumInfo): boolean {
    if (albumInfo?.uri) {
      // 通过pickerController向PhotoPickerComponent发送消息,通知其刷新
    }
    return true;
  }

  build() {
    RelativeContainer() {
      AlbumPickerComponent({
        albumPickerOptions: this.albumPickerOptions,
        onAlbumClick:(albumInfo: AlbumInfo): boolean => this.onAlbumClick(albumInfo),
      }).height('100%').width('100%')
    }
    .height('100%')
    .width('100%')
  }
}
分享
微博
QQ
微信
回复
1天前
相关问题
HarmonyOS picker使用问题确认
336浏览 • 1回复 待解决
@ohos.inputMethod无法使用怎么回事?
2321浏览 • 1回复 待解决
HarmonyOS webview无法加载file协议路径
30浏览 • 1回复 待解决
HarmonyOS picker组件如何隐藏拍照按钮
58浏览 • 1回复 待解决
为何picker-view无法显示出来?
7282浏览 • 2回复 待解决
picker-date日期组件问题?
5460浏览 • 1回复 待解决
HarmonyOS @ohos/protobufjs 使用咨询
535浏览 • 1回复 待解决
HarmonyOS @ohos/pulltorefresh使用问题
38浏览 • 1回复 待解决