ArkUI---使用弹窗---@ohos.promptAction (弹窗)

promptAction.showToast(文本提示框)

showToast(options: ShowToastOptions): void

创建并显示文本提示框,想看官方文档请点我
ShowToastOptions相关参数请点我

完整代码:

typescript 复制代码
import { promptAction } from '@kit.ArkUI'

@Entry
@Component
struct Demo1 {
  build() {
    Column(){
      Button('点击我,弹出提示文本框!').onClick(_=>{
        promptAction.showToast({
          message: 'Hello World!',
          duration:2000
        })
      })

    }.height('100%').width('100%').justifyContent(FlexAlign.Center)
  }
}

promptAction.showDialog(对话框)

showDialog(options: ShowDialogOptions): Promise

创建并显示对话框,对话框响应后异步返回结果。想看官方文档请点我
ShowDialogOptions相关参数请点我


完整代码:

typescript 复制代码
import { promptAction } from '@kit.ArkUI'

@Entry
@Component
struct Demo1 {
  build() {
   Button('点击出现对话框!').onClick(async _=>{
     await promptAction.showDialog({
       title:'Title标题',
       message:'Message Info',
       buttons:[
         {
           text:'button1',
           color:'#000000'
         },
         {
           text:'button2',
           color:'#000000'
         }
       ],
     })
   }).width(200).height('80')
  }
}
相关推荐
云川之下31 分钟前
【网络】华为交换机S3700与S5700详解
服务器·网络·华为
kirk_wang3 小时前
Flutter Catcher 在鸿蒙端的错误捕获与上报适配指南
flutter·移动开发·跨平台·arkts·鸿蒙
奔跑的露西ly5 小时前
【HarmonyOS NEXT】沉浸式页面实现
华为·harmonyos
小Tomkk5 小时前
我开发的一款鸿蒙游戏《猜数字大师》 应用介绍 和技术架构
游戏·华为·harmonyos
鸿蒙开发工程师—阿辉5 小时前
HarmonyOS 5 数据持久化:状态持久化 (PersistentStorage)
华为·harmonyos
C雨后彩虹6 小时前
字符串拼接
java·数据结构·算法·华为·面试
音浪豆豆_Rachel6 小时前
Flutter鸿蒙化之深入解析Pigeon可空返回与参数设计:nullable_returns.dart全解
flutter·harmonyos
音浪豆豆_Rachel6 小时前
Flutter鸿蒙跨平台测试策略解析:从基础Widget测试到平台集成验证
flutter·harmonyos
音浪豆豆_Rachel6 小时前
Flutter鸿蒙跨平台通信协议解析:Pigeon生成的Dart端桥接艺术
flutter·华为·harmonyos