angular - 使用 Tabview/BottomNavigation 保留或删除 BottomNavigation 栏时如何区分路由
问题描述
这可能比 NativeScript 更像是一个 Angular Routing 问题,但我的应用程序使用的是 NativeScripts BottomNavigation 组件。当从该组件中的选项卡导航到子组件时,它始终将底部导航选项卡保留在屏幕底部。我想让导航到底部没有标签的完全“新”页面成为可能
在我的选项卡路由模块中,我有:
const routes: Routes =[
{ path: '', redirectTo: '/default', pathMatch: 'full' },
{
path: "default", component: TabsComponent, children: [
{
path: "profile",
component: NSEmptyOutletComponent,
loadChildren: () => import("~/app/profile/profile.module").then((m) => m.ProfileModule),
outlet: "profileTab"
},
{
path: "home",
component: NSEmptyOutletComponent,
loadChildren: () => import("~/app/home/home.module").then((m) => m.HomeModule),
outlet: "homeTab"
}
然后在我的家庭路由模块中:
const routes: Routes = [
{ path: "", redirectTo: "default" },
{ path: "default", component: HomeComponent },
{ path: "next", component: HomeNextComponent }
];
因此,当我在 home.component 中并尝试导航到“HomeNextComponent”时,我使用此导航:
this.router.navigate(['../next'], {
transition: { name: 'slideLeft', duration: 250 },
relativeTo: this.activatedRoute
});
它将我导航到 HomeNextComponent,但它保留了 BottomNavigation,当我想“保留”或“删除”BottomNavigation 时如何区分?
解决方案
我认为问题出在您的默认应用程序组件上。检查默认应用程序组件的 html 代码,您可能正在共享相同的底部 html,只是更改了里面的内容<router-outlet></router-outlet>
。
推荐阅读
- swift - Swift:在节点之间接触时执行命令
- c# - 为什么我无法获得统一触摸输入?
- python - 总和为一个数字但最小化标准偏差的固定长度列表
- assembly - MIPS 汇编代码计算字符串中的位数
- excel - 如何比较2张纸中的行,然后将不同的行复制到另一张纸vba
- java - 寻找退出系统或停止代码的方法
- regex - 如何为 apache nutch 正则表达式网站 URL?
- algorithm - 排名 - 最小化成对比较
- python-3.x - 使用 Python ElementTree 在 xml 存档中获取邻居元素
- react-native - 在 React Native 中按下回车时如何禁用在多行 TextInput 中插入新行