HarmonyOS CustomDialog里面使用router.push,dialog被关闭
@Preview
@CustomDialog
export struct UserAgreeConfirmDialog {
controller?: CustomDialogController
onExitListener?: () => void
onAgreeListener?: () => void
build() {
Column() {
Text("用户协议及隐私保护")
.fontSize(18)
.fontColor($r("app.color.color_333333"))
.fontWeight(FontWeight.Medium)
.margin({ top: 15 })
Text() {
Span("为保障您的合法权益,请阅读并同意").fontSize(15).fontColor($r('app.color.color_333333'))
Span("《用户协议》").fontSize(15).fontColor($r('app.color.color_2abddd')).onClick(() => {
let options: router.RouterOptions = {
url: 'pages/WebPage',
params: new toWebViewPageRouterParams(ServiceUrls.SERVICE_URL, "用户协议")
}
router.pushUrl(options)
})
Span("以及").fontSize(15).fontColor($r('app.color.color_333333'))
Span("《隐私政策》").fontSize(15).fontColor($r('app.color.color_2abddd')).onClick(() => {
let options: router.RouterOptions = {
url: 'pages/WebPage',
params: new toWebViewPageRouterParams(ServiceUrls.PROTOCOL_URL, "隐私政策")
}
router.pushUrl(options)
})
}.margin({ top: 25 })
.width("80%")
Text("严格保护您的个人信息安全")
.fontSize(15)
.margin({ top: 25 })
.width("80%")
Button('同意并登录', { type: ButtonType.Capsule, stateEffect: false })
.opacity(1)
.borderRadius(4)
.backgroundColor($r('app.color.color_E0433B'))
.onClick(() => {
console.log('ButtonType.Normal')
})
.height(46)
.width("90%")
.flexShrink(1)
.fontSize(15)
.fontColor($r('app.color.white'))
.margin({ top: 20 })
.onClick(() => {
if (this.onAgreeListener) {
this.onAgreeListener()
}
})
Text("不同意")
.fontColor($r('app.color.color_8F8F8F'))
.fontSize(15)
.margin({ top: 15, bottom: 15 })
.onClick(() => {
// if (this.onExitListener) {
// this.onExitListener()
// }
})
}.width("80%")
.backgroundColor($r('app.color.white'))
.borderRadius({ topLeft: 6, topRight: 6, bottomLeft: 6, bottomRight: 6 })
}
}
- 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.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
HarmonyOS
赞
收藏 0
回答 1
相关问题
HarmonyOS customDialog调用router.push启动新页面,会把customDialog关闭
578浏览 • 1回复 待解决
customDialog调用router.push启动新页面,会把customDialog关闭,怎么实现在不关闭弹窗的前提下启动新页面
2577浏览 • 1回复 待解决
Navigator和router.push有啥区别?
5558浏览 • 1回复 待解决
HarmonyOS 子窗口如何通过router.push()在主窗口打开页面
861浏览 • 1回复 待解决
HarmonyOS 怎么控制push到下个页面不关闭customDialog
545浏览 • 1回复 待解决
router.push失效,因为config.json下面没有对应的页面路径
1092浏览 • 1回复 待解决
HarmonyOS CustomDialog里的text点击跳转新的page之后 这个dialog会自动关闭
1472浏览 • 1回复 待解决
HarmonyOS CustomDialog和 半模态 内部有页面跳转,push到新的页面,页面会被dialog遮挡
545浏览 • 1回复 待解决
HarmonyOS 用CustomDialog自定义Dialog
1140浏览 • 1回复 待解决
dialog跳转新页面返回后dialog关闭
1023浏览 • 1回复 待解决
如何获取router push的所有page?
1030浏览 • 0回复 待解决
HarmonyOS 在@CustomDialog中使用TextArea关闭弹窗后,键盘没有隐藏
597浏览 • 1回复 待解决
HarmonyOS 自定义弹窗(CustomDialog)无法关闭
1437浏览 • 1回复 待解决
HarmonyOS dialog如何禁止侧滑返回关闭
661浏览 • 1回复 待解决
HarmonyOS CustomDialog全局弹框可以在静态库har里面使用吗
667浏览 • 1回复 待解决
HarmonyOS 跳转页面时customDialog不自动关闭
921浏览 • 1回复 待解决
HarmonyOS CustomDialog内跳转其他页面弹窗不关闭
894浏览 • 1回复 待解决
HarmonyOS ComponentContent封装的Dialog能设置点击Dialog区域外,不自动关闭吗?
504浏览 • 1回复 待解决
如何关闭router中的指定页面?
945浏览 • 1回复 待解决
HarmonyOS 关于CustomDialog使用
1083浏览 • 1回复 待解决
HarmonyOS 自定义dialog 支持返回按钮不关闭
1255浏览 • 1回复 待解决
HarmonyOS CustomDialog关闭后重新打开,内部状态丢失问题
1062浏览 • 1回复 待解决
HarmonyOS CustomDialog和TextInput弹起后,键盘与Dialog中间有间距
492浏览 • 1回复 待解决
HarmonyOS CustomDialog有输入框,如何禁止软键盘顶起Dialog
915浏览 • 1回复 待解决
目前有两种方案实现:
方案1:通过Stack容器结合其它组件,使用UI组件模拟Dialog的效果,简单示例:
方案2:在页面的onPageShow()这个生命周期方法中调用open()方法打开,简单示例: