#鸿蒙学习大百科#如何通过ActionSheet实现带列表的弹窗?

如何通过ActionSheet实现带列表的弹窗?

HarmonyOS
2024-10-26 09:54:13
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
海底捞天王
@Entry
@Component
struct Index {
  build() {
    Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
      Button('Click to Show ActionSheet')
        .onClick(() => {
          ActionSheet.show({
            title: 'ActionSheet title',
            subtitle: 'ActionSheet subtitle',
            message: 'message',
            autoCancel: true,
            confirm: {
              defaultFocus: true,
              value: 'Confirm button',
              action: () => {
                console.log('Get Alert Dialog handled')
              }
            },
            alignment: DialogAlignment.Bottom,
            offset: { dx: 0, dy: -10 },
            sheets: [
              {
                title: 'apples',
                action: () => {
                  console.log('apples')
                }
              },
              {
                title: 'bananas',
                action: () => {
                  console.log('bananas')
                }
              },
              {
                title: 'pears',
                action: () => {
                  console.log('pears')
                }
              }
            ]
          })
        })
    }
    .width('100%')
  }
}
分享
微博
QQ
微信
回复
2024-10-26 16:32:43
相关问题
#鸿蒙学习大百科#如何实现ui优化?
239浏览 • 1回复 待解决