HarmonyOS 寻求一份隐私协议弹窗的demo,点击dialog中的蓝色字体可以跳转

HarmonyOS
2024-12-20 18:01:29
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
aquaa
//自定义弹窗的代码
@CustomDialog
export struct CustomPrivacyAgreement{
  controller:CustomDialogController = new CustomDialogController({
    builder:CustomPrivacyAgreement({})
  })
  sample:string = '为了保护用户隐私信息,确保用户获得良好的登录体验,根据《华为开发者服务协议》、《华为APIs使用协议》、《应用审核指南》、《元服务审核指南》等相关协议条款及现行法律法规,平台制定了华为帐号登录管理细则,使用华为帐号登录的应用请遵照执行,具体要求如下:'

  build() {
    Column(){
      TextArea({text:this.sample}).maxLength(10000)
      Row(){
        Text('同意').onClick(()=>{
          router.pushUrl({
            url:'pages/MainPage'//同意协议时跳转的页面
          })

        })
        Text('拒绝').onClick(()=>{
          const context = getContext(this) as common.UIAbilityContext;
          context.terminateSelf()//退出app
        })
      }.width('60%').justifyContent(FlexAlign.SpaceBetween)

    }.width('50%').height('50%')

  }

}
/*启动Page页面(闪屏页面)的代码*/
//定义controller
controller:CustomDialogController = new CustomDialogController({
  builder:CustomPrivacyAgreement({})
})
//编写方法
aboutToAppear() {
  this.controller.open()
}
  • 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.
分享
微博
QQ
微信
回复
2024-12-20 19:48:17
相关问题
HarmonyOS dialog弹窗跳转问题
711浏览 • 1回复 待解决
HarmonyOS 隐私政策用户协议
980浏览 • 1回复 待解决
HarmonyOS 隐私协议弹框
732浏览 • 1回复 待解决
Text模拟隐私协议,有好方案吗?
1548浏览 • 1回复 待解决
HarmonyOS 自定义弹窗点击跳转问题
825浏览 • 1回复 待解决