HarmonyOS 弹窗不与页面绑定demo

HarmonyOS 弹窗不与页面绑定demo。

HarmonyOS
2024-10-22 10:10:49
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
superinsect

根页面:

import { CaseDialog } from '../cases/navDialog/CaseDialog'  
import { AppRouter } from '../router/AppRouter'  
import { PrivacyPage } from '../cases/navDialog/view/PrivacyPage'  
import { CommonConstants } from '../common/CommonConstants'  
import { DefaultDialog } from '../cases/navDialog/DefaultDialog'  
import { AppDialog } from '../util/AppDialog'  
import { PrivacyDialogViewBuilder } from '../cases/navDialog/view/PrivacyDialogView'  
  
@Entry  
@Component  
struct Index {  
  @Builder  
  PageMap(name: string) {  
    if (name === 'dialog') {  
      CaseDialog()  
    } else if (name === CommonConstants.PRIVACY_PAGE) {  
      PrivacyPage()  
    } else if (name === CommonConstants.DEFAULT_DIALOG) {  
      DefaultDialog()  
    }  
  }  
  
  aboutToAppear(): void {  
    AppDialog  
      .build(wrapBuilder(PrivacyDialogViewBuilder))  
      .onBackPressed((): boolean => true)  
      .open();  
  }  
  
  build() {  
    Navigation(AppRouter.getInstance().getPathStack()) {  
      Stack({ alignContent: Alignment.Center }) {  
        Column() {  
          Button('page2', { stateEffect: true, type: ButtonType.Capsule })  
            .onClick(() => {  
              AppRouter.push('privacyPage')  
            })  
        }  
      }  
      .height("100%")  
      .width("100%")  
    }  
    .hideTitleBar(true)  
    .navDestination(this.PageMap)  
  }  
}
分享
微博
QQ
微信
回复
2024-10-22 17:04:23
相关问题
HarmonyOS 全局弹窗demo
62浏览 • 1回复 待解决
HarmonyOS 音视频弹窗demo
35浏览 • 1回复 待解决
HarmonyOS 全局自定义弹窗demo
293浏览 • 1回复 待解决
HarmonyOS 页面弹窗的样式弹出
543浏览 • 1回复 待解决
HarmonyOS 需要一个筛选页面demo
366浏览 • 1回复 待解决
弹窗跳转到页面后返回弹窗不消失
1670浏览 • 1回复 待解决
HarmonyOS h5拉起系统扫码页面demo
226浏览 • 1回复 待解决
HarmonyOS $$双向绑定问题
296浏览 • 1回复 待解决