HarmonyOS鸿蒙Next中Navigation组件设置hideTitleBar后页面为什么白屏?从主页跳转过来页面只有返回箭头
HarmonyOS鸿蒙Next中Navigation组件设置hideTitleBar后页面为什么白屏?从主页跳转过来页面只有返回箭头
@Builder export function mainBuilder(name: string) { Navigation() { Main() } }
@Entry @Component struct Main { packMain: NavPathStack = new NavPathStack() @State message: string = ‘hello world’
build() { Navigation(this.packMain) { Column() { Text(this.message) .onClick(() => { this.message = ‘Welcome’; }) } .height(‘100%’) .width(‘100%’) } .hideTitleBar(true) } }
更多关于HarmonyOS鸿蒙Next中Navigation组件设置hideTitleBar后页面为什么白屏?从主页跳转过来页面只有返回箭头的实战教程也可以访问 https://www.itying.com/category-93-b0.html
本页设置 hidNavBar(true) 后全白屏怎么办
设置是否隐藏导航栏。设置为true时,隐藏Navigation的导航栏,包括标题栏、内容区和工具栏。如果此时路由栈中存在NavDestination页面,则直接显示栈顶NavDestination页面,反之显示空白。
参考链接
是不是你的路由栈有问题?
Index
Text('Index').fontSize(30)
Main
Text(this.message)
- fontSize:
$r('app.float.page_text_font_size') - fontWeight:
Bold - alignSelf:
Center - onClick:
() => { this.message = 'Welcome'; }
跳转后的内容需要使用 NavDestination 包裹
设置 hidNavBar(true) 之后本页内容也白屏了。


