NavDestination 可以自定义title样式参考Demo@Entry @Component struct NavRouterExample { @State isActiveWLAN: boolean = false @State isActiveBluetooth: boolean = false @Builder titleStyle(){ Text('标题') .textAlign(TextAlign.Center) .fontSize(30) .position({ x: '50%'}) .translate({x:'-50%'}) } build() { Column() { Navigation() { NavRouter() { Row() { Row().width(30).height(30).borderRadius(30).margin({ left: 3, right: 10 }).backgroundColor(Color.Pink) Text(`WLAN`) .fontSize(22) .fontWeight(500) .textAlign(TextAlign.Center) } .width('90%') .height(72) NavDestination() { Flex({ direction: FlexDirection.Row }) { Text('未找到可用WLAN').fontSize(30).padding({ left: 15 }) } } .title(this.titleStyle()) .hideTitleBar(false).backgroundColor('#0c182431') }.backgroundColor(this.isActiveWLAN ? '#ccc' : '#fff') .borderRadius(24) .onStateChange((isActivated: boolean) => { this.isActiveWLAN = isActivated }) NavRouter() { Row() { Row().width(30).height(30).borderRadius(30).margin({ left: 3, right: 10 }).backgroundColor(Color.Pink) Text(`蓝牙`) .fontSize(22) .fontWeight(500) .textAlign(TextAlign.Center) } .width('90%') .height(72) NavDestination() { Flex({ direction: FlexDirection.Row }) { Text('未找到可用蓝牙').fontSize(30).padding({ left: 15 }) } }.hideTitleBar(false).backgroundColor('#0c182431') }.backgroundColor(this.isActiveBluetooth ? '#ccc' : '#fff') .borderRadius(24) .onStateChange((isActivated: boolean) => { this.isActiveBluetooth = isActivated }) } .title('设置') .titleMode(NavigationTitleMode.Free) .mode(NavigationMode.Auto) .hideTitleBar(false) .hideToolBar(true) }.height('100%') } }参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-basic-components-navdestination-V5
NavDestination 可以自定义title样式参考Demo
参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-basic-components-navdestination-V5