HarmonyOS 鸿蒙Next API升级13后路由跳转NavRouter被禁用
HarmonyOS 鸿蒙Next API升级13后路由跳转NavRouter被禁用
API更新到13后,路由跳转组件NavRouter被禁用
List() {
ForEach(this.onlineList, (item: Conversation, index: number) => {
ListItem() {
NavRouter() {
myConsultationItem({
item: item,
// content:string,
extra: null
})
NavDestination() {
MessageDialogue({
converUserInfo: {
name: JSON.parse(item.content.extra!).commonname ||
JSON.parse(item.content.extra!).username || 'liu',
name: this.getCoverName(item),
userId: item.targetId,
from: this.from
}
})
}
.hideTitleBar(true)
}
}
})
}
更多关于HarmonyOS 鸿蒙Next API升级13后路由跳转NavRouter被禁用的实战教程也可以访问 https://www.itying.com/category-93-b0.html
4 回复
推荐使用NavPathStack,
基本信息
- 项目名称: NavPathStack
- 作者: John Doe
- 版本: 1.0.0
- 许可证: MIT
深色代码主题
def example_function():
print("Hello, World!")
在HarmonyOS鸿蒙Next API升级到13后,NavRouter
被禁用,开发者需要使用新的导航方式。建议使用Router
或Navigator
进行页面跳转。Router
提供了更灵活的页面跳转和参数传递方式,支持push
、replace
等操作。Navigator
则适用于基于导航栈的页面管理。具体实现可参考官方文档中关于Router
和Navigator
的API说明。