HarmonyOS应用开发-eTS-警告弹窗

鸿蒙时代
发布于 2021-12-22 14:10
浏览
0收藏

显示警告弹窗组件,可设置文本内容与响应回调。
HarmonyOS应用开发-eTS-警告弹窗-鸿蒙开发者社区
HarmonyOS应用开发-eTS-警告弹窗-鸿蒙开发者社区
HarmonyOS应用开发-eTS-警告弹窗-鸿蒙开发者社区
HarmonyOS应用开发-eTS-警告弹窗-鸿蒙开发者社区
案例

@Entry
@Component
struct Index {
  build() {
    Flex({direction:FlexDirection.Column,alignItems:ItemAlign.Center,justifyContent:FlexAlign.Center,}){
        Button('下一步',)
          .onClick(() => {
            AlertDialog.show(
              {
                title: '第999关',
                message: '恭喜你通关啦!',
                confirm: {
                  value: '确定',
                  action: () => {
                    console.info('通过')
                  }
                },
                cancel: () => {
                  console.info('结束')
                }
              }
            )
          })
          .backgroundColor(0x317aff)
          .width('200')
          .margin('20')
        Button('访问')
          .onClick(() => {
            AlertDialog.show(
              {
                title: '访问权限',
                message: '是否允许访问您设备上的照片与媒体',
                primaryButton: {
                  value: '禁止',
                  action: () => {
                    console.info('no')
                  }
                },
                secondaryButton: {
                  value: '允许',
                  action: () => {
                    console.info('ok')
                  }
                },
                cancel: () => {
                  console.info('结束')
                }
              }
            )
          }).backgroundColor(0x317aff)
          .width('200')
          .margin('10')
    }
    .width('100%')
    .height('100%')
  }
}

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.

效果图:
HarmonyOS应用开发-eTS-警告弹窗-鸿蒙开发者社区

标签
HarmonyOS应用开发-eTS-警告弹窗.docx 45.32K 19次下载
收藏
回复
举报
回复
    相关推荐