中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
如何通过NavPathStack来拦截路由中的页面?
微信扫码分享
this.pageStack.setInterception({ willShow: (from: NavDestinationContext | "navBar", to: NavDestinationContext | "navBar", operation: NavigationOperation, animated: boolean) => { if (typeof to === "string") { console.log("target page is navigation home page."); return; } // 将跳转到PageTwo的路由重定向到PageOne let target: NavDestinationContext = to as NavDestinationContext; if (target.pathInfo.name === 'PageTwo') { target.pathStack.pop(); target.pathStack.pushPathByName('PageOne', null); } } })