<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      鴻蒙應用開發從入門到實戰(二十一):ArkUI自定義彈窗組件

      大家好,我是潘Sir,持續分享IT技術,幫你少走彎路。《鴻蒙應用開發從入門到項目實戰》系列文章持續更新中,陸續更新AI+編程、企業級項目實戰等原創內容、歡迎關注!

      上一篇文章講述了ArkUI提供的各種內置彈窗組件,當項目中遇到這些組件仍然不滿足需求時,可以使用自定義彈窗組件。本文研究自定義彈窗組件的使用。

      一、概述

      當現有組件不滿足要求時,可考慮自定義彈窗,自定義彈窗允許開發者自定義彈窗內容和樣式。例如

      1自定義彈窗

      示例代碼

      pages/component/dialog/新建CustomDialogPage.ets文件

      @Entry
      @Component
      struct CustomDialogPage {
        @State answer: string = '?'
        controller: CustomDialogController = new CustomDialogController({
          builder: TextInputDialog({
            confirm: (value) => {
              this.answer = value;
            }
          }),
          alignment: DialogAlignment.Bottom,
          offset: { dx: 0, dy: -30 }
        })
      
        build() {
          Column({ space: 50 }) {
            Row() {
              Text('1+1=')
                .fontWeight(FontWeight.Bold)
                .fontSize(30)
              Text(this.answer)
                .fontWeight(FontWeight.Bold)
                .fontSize(30)
            }
      
            Button('作答')
              .onClick(() => {
                this.controller.open();
              })
          }.width('100%')
          .height('100%')
          .justifyContent(FlexAlign.Center)
        }
      }
      
      
      @CustomDialog
      struct TextInputDialog {
        controller: CustomDialogController = new CustomDialogController({ builder: TextInputDialog() })
        confirm: (value: string) => void;
        value: string = '';
      
        build() {
          Column({ space: 20 }) {
            Text('請輸入你的答案')
            TextInput({ placeholder: '請輸入數字' })
              .type(InputType.Number)
              .onChange((value) => {
                this.value = value;
              })
            Row({ space: 50 }) {
              Button('取消')
                .onClick(() => {
                  this.controller.close();
                })
              Button('確認').onClick(() => {
                this.confirm(this.value);
                this.controller.close();
              })
            }
          }.padding(20)
        }
      }
      

      二、使用說明

      顯示自定義彈窗需要使用CustomDialogController

      https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V2/arkts-common-components-custom-dialog-0000001450754206-V2

      《鴻蒙應用開發從入門到項目實戰》系列文章持續更新中,陸續更新AI+編程、企業級項目實戰等原創內容,防止迷路,歡迎關注!

      posted @ 2025-10-14 09:38  程序員潘Sir  閱讀(215)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 色九月亚洲综合网| 成人午夜免费无码视频在线观看| av小次郎网站| 欧美18videosex性欧美tube1080| 午夜视频免费试看| 精品国产午夜福利理论片| 国产精品久久久久aaaa| 亚洲国产区男人本色vr| 国产高清在线精品一区不卡| 国产性色的免费视频网站| 乱色熟女综合一区二区三区| 成人午夜在线观看日韩| 一区二区在线观看成人午夜| 亚洲成熟女人毛毛耸耸多| 亚洲av精彩一区二区| 日本高清中文字幕免费一区二区| 西盟| 日韩有码中文字幕第一页| 国产亚洲精品超碰热| 野花在线观看免费观看高清| 欧美成人精品一级在线观看| 欧美黑吊大战白妞| 人人妻人人澡人人爽曰本| 伊人久在线观看视频| 精品无码久久久久国产电影| 91九色国产成人久久精品| 國产AV天堂| 国产欧美日韩精品第二区| 成人午夜福利一区二区四区| 色综合天天综合天天综| 99久久无色码中文字幕| 成人一区二区三区在线午夜| 女人香蕉久久毛毛片精品| 丝袜人妖av在线一区二区| 老熟妇欲乱一区二区三区| 国产亚洲综合欧美视频| 亚洲大尺度视频在线播放| 人人妻人人做人人爽| 人妻少妇偷人精品免费看| 国产福利萌白酱在线观看视频| 人成午夜免费大片|