在HarmonyOS NEXT开发中Navigation 的页面路由用法 NavPathStack 的 pushPath 方法的name参数在什么地方配置?
在HarmonyOS NEXT开发中Navigation 的页面路由用法 NavPathStack 的 pushPath 方法的name参数在什么地方配置?
参考如下demo:
@Entry
@Component
struct NavigationExample {
pageInfos: NavPathStack = new NavPathStack()
build() {
Navigation(this.pageInfos) {
Column() {
Button('pushPath', { stateEffect: true, type: ButtonType.Capsule })
.width('80%')
.height(40)
.margin(20)
.onClick(() => {
this.pageInfos.pushPath({ name: 'pageOne' }) //将name指定的NavDestination页面信息入栈
})
Button('use interception', { stateEffect: true, type: ButtonType.Capsule })
.width('80%')
.height(40)
.margin(20)
.onClick(() => {
this.isUseInterception = !this.isUseInterception;
if (this.isUseInterception) {
this.registerInterception();
} else {
this.pageInfos.setInterception(undefined);
}
})
}
}.title('NavIndex')
}
}
Navigation 的页面路由用法 NavPathStack 的 pushPath 方法的name参数如下配置:
this.pageInfos.pushPath({ name: 'pageOne' })
1 回答869 阅读✓ 已解决
1 回答1.2k 阅读
1 回答997 阅读
1 回答951 阅读
1 回答917 阅读
1 回答830 阅读
1 回答783 阅读
你可以参考下面的文档
pushPath使用: https://developer.huawei.com/consumer/cn/doc/harmonyos-refere...
NavPathInfo:https://developer.huawei.com/consumer/cn/doc/harmonyos-refere...