简体   繁体   English

使用Bulma和Angular 5创建选项卡并调用子组件

[英]Creating Tabs and calling sub-components with Bulma and Angular 5

I want to create a navigation panel with tabs, I'm using Bulma, I'll show an example from the documentation. 我想创建一个带有标签的导航面板,我正在使用Bulma,我将展示文档中的示例。 I'm using routing for the navigation of the project, but from my Matches component, I want to call a subcomponent from each tab. 我正在使用路由进行项目导航,但是从我的Matches组件中,我想从每个选项卡调用一个子组件。 在此处输入图片说明

 <div class="tabs">
       <ul>
        <li class="is-active"><a>Upcoming</a></li>
        <li><a>Past</a></li>
      </ul>
    </div>

Working like this: From the matches component call a subcomponent app-upcoming and app-past 像这样工作:从“匹配”组件中调用子组件app-upcomingapp-past

 <div class="upcoming">
     <app-upcoming></app-upcoming>
    </div>
    <div class="past">
     <app-past></app-past>
   </div>

Use the router-outlet to specify where to display the route components: 使用路由器插座来指定显示路由组件的位置:

https://angular.io/tutorial/toh-pt5#add-routeroutlet https://angular.io/tutorial/toh-pt5#add-router插座

When you use a route component, like this from the documentation. 当您使用路线组件时,请参见文档中的内容。

import { HeroesComponent }      from './heroes/heroes.component';

const routes: Routes = [
  { path: 'heroes', component: HeroesComponent }
];

The component will get loaded into the router-outlet when the path matches heroes. 当路径与英雄匹配时,该组件将被加载到路由器插座中。 I'd recommend reading the routing documentation and following it along. 我建议阅读路由文档并继续阅读。

It is super easy you just go with router. 只需使用路由器,超级简单。 Take a look of https://angular.io/guide/router . 看看https://angular.io/guide/router

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Angular 2,不渲染动态组件的子组件 - Angular 2, sub-components of dynamic component are not rendered 棱角分明。 如何在外部定义点击,不包括子组件? - Angular. How to define a click outside, excluding sub-components? 使用带有 props 的子组件动态反应 - React dynamically using sub-components with props 使用动态子组件对组件进行反应 - React Component with dynamic Sub-Components 聚合物2.0:在Chrome的测试中未呈现的子组件 - Polymer 2.0: Sub-components not rendered in tests on Chrome 如何正确地将一个组件的代码拆分为多个子组件? - How to properly split the code of a component into sub-components? 改变React状态的最佳方法 <App /> 基于子组件的级别 - Best way to change React state at <App /> level based on sub-components Material UI如何使用整个组件的一种主要通用样式设置子组件的外部样式 - Material UI How to set external styles for sub-components with one main common style for the entire component 在使用Jest单元测试React组件时如何模拟子组件 - How to mock out sub-components when unit testing a React component with Jest 当React / Flux中有多个小的可重复子组件时,如何管理组件渲染 - How to manage component rendering when there are several small, repeatable sub-components in React/Flux
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM