当前位置: 首页 > news >正文

郑州做网站茂睿科技制作哈尔滨主题的网页

郑州做网站茂睿科技,制作哈尔滨主题的网页,室内设计资料网站,查询网站死链接鸿蒙通用组件弹窗简介 弹窗----Toast引入ohos.promptAction模块通过点击按钮#xff0c;模拟弹窗 警告对话框----AlertDialog列表弹窗----ActionSheet选择器弹窗自定义弹窗使用CustomDialog声明一个自定义弹窗在需要使用的地方声明自定义弹窗#xff0c;完整代码 弹窗----Toa… 鸿蒙通用组件弹窗简介 弹窗----Toast引入ohos.promptAction模块通过点击按钮模拟弹窗 警告对话框----AlertDialog列表弹窗----ActionSheet选择器弹窗自定义弹窗使用CustomDialog声明一个自定义弹窗在需要使用的地方声明自定义弹窗完整代码 弹窗----Toast 引入ohos.promptAction模块 import promptAction from ohos.promptAction通过点击按钮模拟弹窗 Button(点击).width(60%).height(50).onClick((){promptAction.showToast({message:点击了按钮, // 展示的文字duration:2000, // 停留时长bottom: 100 // 距离底部多远})})警告对话框----AlertDialog AlertDialog用于向用户提出告警或者确认的对话框。 AlertDialog.show({title:提示信息,message:此信息比较重要请确认!!!,autoCancel: true, //点击遮障层时是否关闭弹窗alignment: DialogAlignment.Bottom, //弹窗位置offset: { dx: 0, dy: -30 }, //相对于弹窗位置的偏移量primaryButton: { //主要按钮value: 确认, //按钮内容fontColor: Color.Red, //字体颜色action: () { //点击回调console.log(点击了确认按钮)}},secondaryButton: { //次要按钮value: 取消,action: () {console.log(点击了取消按钮)}},cancel: () { //点击遮罩层取消时的回调console.info(点击遮罩层取消时的回调)} })列表弹窗----ActionSheet ActionSheet用于给用户一组列表弹窗等用户选择后再作处理。 ActionSheet.show({ title:提示信息, message: 此信息比较重要请确认!!!, autoCancel: true, //点击遮障层时是否关闭弹窗 alignment: DialogAlignment.Center, //弹窗位置 offset: { dx: 0, dy: -20 }, //弹窗相对alignment位置的偏移量 confirm: { //底部按钮value: 取消, //按钮文本内容action: () { //按钮回调函数console.log(点击按钮取消)} }, cancel: () { //点击遮障层关闭弹窗时的回调console.log(点击遮障层取消) }, sheets:[{title:操作1,action: () {console.log(操作1)}},{title:操作2,action: () {console.log(操作2)}},{title:操作3,action: () {console.log(操作3)}}, ] })alignment的几种位置 DialogAlignment.Top 上部 DialogAlignment.Center 中间 DialogAlignment.Bottom 底部 DialogAlignment.TopStart 左上部 DialogAlignment.TopEnd 右上部 DialogAlignment.CenterStart 中间左边 DialogAlignment.CenterEnd 中间右边 DialogAlignment.BottomStart 左下部 DialogAlignment.BottomEnd 右下部选择器弹窗 鸿蒙API中有很多选择器弹窗比如时间、日期、文本等这里就不做介绍。 自定义弹窗 在实际使用过程中一定会遇到官方提供的弹窗不能满足需要的情况这时候就需要尽心自定义。 这里举一个自定义弹窗的简单例子 使用CustomDialog声明一个自定义弹窗 CustomDialog struct CustomDialogText{controller: CustomDialogController new CustomDialogController({ builder: CustomDialogText() })build(){Column({space: 20}){Text(内容1)Text(内容2)Text(内容3)}.margin(20).onClick((){this.controller.close()})} }在build里面定义UI样式这里只做为展示随便定义了几个展示的文本内容 在需要使用的地方声明 在使用过程中需要需要初始化CustomDialogController。 controller: CustomDialogController new CustomDialogController({builder: CustomDialogText(),// builder就是自定义的弹窗alignment: DialogAlignment.Center, // 弹窗弹出位置offset:{dx: 0, dy: -10} // 弹窗弹出后的偏移量按需要进行设置 })定义好controller之后在使用的时候直接调用this.controller.open()。 自定义弹窗完整代码 Entry Component struct CommentTest{controller: CustomDialogController new CustomDialogController({builder: CustomDialogText(),alignment: DialogAlignment.Center,offset:{dx: 0, dy: -10}})build(){Column({space: 20}){Button(点击弹出自定义弹窗).width(60%).height(50).onClick((){this.controller.open()})}.width(100%).height(100%).justifyContent(FlexAlign.Center)} }CustomDialog struct CustomDialogText{controller: CustomDialogController new CustomDialogController({ builder: CustomDialogText() })build(){Column({space: 20}){Text(内容1)Text(内容2)Text(内容3)}.margin(20).onClick((){this.controller.close()})} }
http://www.w-s-a.com/news/953749/

相关文章:

  • 免费建设网站赚钱小程序开发文档pdf
  • ucenter 整合两个数据库网站网店推广技巧
  • 网站优化排名提升百度wap
  • 八里河风景区网站建设内容摘要网站开发基础学习
  • 上海做外贸网站的公司智慧团建网站登陆平台
  • 上海商务网站建设如何做的网站手机可以用吗
  • 产品推广营销方案seo推广员招聘
  • 做水利网站需要多少钱山东市网站建设
  • 做网站找哪里如何修改wordpress颜色
  • 招商加盟网站系统站长工具 seo查询
  • 工商局网站清算组备案怎么做电商培训机构
  • 做好门户网站建设做本地团购网站怎么样
  • wordpress主题和预览不同20条优化防疫措施方案
  • 艾奇视觉网站建设网站推广需要几个人做
  • 2008 iis 添加网站wordpress固定链接标签加上页面
  • 宁波企业网站制作推荐网站优化人员
  • 大型资讯门户网站怎么做排名沈阳建设工程有限公司
  • 开发中英文切换网站如何做江苏网站建设费用
  • 网站论文首页布局技巧桥东网站建设
  • 网站开发项目经理工资北京微信网站
  • 山西山西省建设厅网站微信备份如何转换为wordpress
  • 同城网站开发实用网站模板
  • 郑州做网站哪家公司好国外购买空间的网站有哪些
  • 资讯cms网站有那些餐饮品牌策划设计公司
  • 网站策划选题网站布局优化
  • 网站建设3000字wordpress 微信 主题制作
  • 代做寄生虫网站网站菜单效果
  • 网站备案为什么这么慢目录更新 wordpress
  • 视频在线制作网站Wordpress 外链图片6
  • 网站域名后缀有什么用网站建设的投资预算怎么写