中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
微信扫码分享
那当然有了`promptAction`就是弹窗api ```javascript import { `promptAction` } from '@kit.ArkUI' import { `BusinessError` } from '@kit.BasicServicesKit'; @Entry @Component struct toastExample { build() { Column() { Button('Show toast').fontSize(20) .onClick(() => { try { `promptAction`.showToast({ message: 'Hello World', duration: 2000 }); } catch (error) { let message = (`error` as `BusinessError`).message let code = (`error` as `BusinessError`).code console.error(`showToast args error code is ${code}, message is ${message}`); }; }) }.height('100%').width('100%').justifyContent(FlexAlign.Center) } }