tab切换组件nz-tab
<nz-card [nzBordered]="true" nzTitle="卡片标题">
<nz-card style="width: 100%;" nzTitle="Card title" [nzExtra]="extraTemplate">
<nz-card-tab>
<nz-tabset nzSize="large" [(nzSelectedIndex)]="selectIndex">
<nz-tab [nzTitle]="item.title" *ngFor="let item of tabs" (nzClick)="tabTo(item)"></nz-tab>
</nz-tabset>
</nz-card-tab>
<router-outlet></router-outlet>
</nz-card>
</nz-card>
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
@Component({
selector: 'app-card-whole-consume',
templateUrl: './card-whole-consume.component.html',
styles: []
})
export class CardWholeConsumeComponent implements OnInit {
selectIndex = 0;
tabs: any[] = [
{
key: 'dashboard',
title: '标题1'
}, {
key: 'department-salary-setting',
title: '标题2'
}
];
constructor(private router: Router) { }
ngOnInit() {
this.initTab();
}
initTab() {
// 设置再次刷新页面时还是显示之前的tab
const key = this.router.url.substr(this.router.url.lastIndexOf('/') + 1);
const idx = this.tabs.findIndex(w => w.key === key);
this.selectIndex = idx;
this.router.navigateByUrl(`/cardWhole/${this.tabs[this.selectIndex].key}`);
}
tabTo(tab) {
this.router.navigateByUrl(`/cardWhole/${tab.key}`);
}
}
tab切换组件nz-tab的更多相关文章
- react实现的tab切换组件
我有点想要吐槽,因为用原生的js实现起来挺简单的一个小东西,改用react来写却花了我不少时间,也许react的写法只有在复杂的web应用中才能体现出它的优势吧!不过吐槽归吐槽,对react这种优雅的 ...
- Flutter——TabBar组件(顶部Tab切换组件)
TabBar组件的常用属性: 属性 描述 tabs 显示的标签内容,一般使用 Tab 对象,也可以是其他的Widget controller TabController 对象 isScrollabl ...
- 简单的Tab切换组件
由于代码都有注释,所以不多加解释,大家都知道的.直接贴代码: 代码如下: /** * 简单的Tab切换 * 支持可配置项 如下参数 */ function Tab(){ this.config = { ...
- 基于Vue开发的tab切换组件
github地址:https://github.com/MengFangui/VueTabSwitch 1.index.html <!DOCTYPE html> <html lang ...
- React Native 系列(九) -- Tab标签组件
前言 本系列是基于React Native版本号0.44.3写的.很多的App都使用了Tab标签组件,例如QQ,微信等等,就是切换不同的选项,显示不同的内容.那么这篇文章将介绍RN中的Tab标签组件. ...
- echarts tab 切换问题整理
一.bootstrap tabs 解决方案 方式一 tab切换echarts无法正常显示 https://blog.csdn.net/cjs68/article/details/78072382 ta ...
- 使用VUE搭建tab标签组件
Vue2.0 多 Tab切换组件简单封装,满足自己简单的功能,可以直接拿去使用! 首先上效果图: 功能简单介绍: 1.支持tab切换 2.支持tab定位 3.支持tab自动化 仿React多Tab实现 ...
- vue路由+vue-cli实现tab切换
第一步:搭建环境 安装vue-cli cnpm install -g vue-cli安装vue-router cnpm install -g vue-router使用vue-cli初始化项目 vue ...
- jquery+bootstrap实现tab切换, 每次切换时都请求数据, 点击提交分别向不同的地址提交数据
今天一个朋友叫帮做一个tab切换, 每一个tab内容区域都是从后台取出的数据, 这些数据要用表格的形式显示处理, 并且表格的内容区域可以修改, 如下所示: 例子查看请演示查看. 截图如图所示: 实现步 ...
随机推荐
- Iterator 使用
Configuration cfg = new Configuration().configure(); SessionFactory factory = cfg.buildSessionFactor ...
- 洛谷 P1344 追查坏牛奶Pollutant Control —— 最小割
题目:https://www.luogu.org/problemnew/show/P1344 就是求最小割: 但是还要边数最小,所以把边权都*1001+1,这样原来流量部分是*1001,最大流一样的不 ...
- bzoj3160
fft+manacher fft都快忘了... 其实我们发现,这个问题是可以用fft做的,因为是回文子序列,所以我们直接自己和自己求卷积,然后扫描每个位置,注意是每个位置,因为包括奇数长度和偶数长度, ...
- vs 中switch语句快捷键列出枚举
先switch然后两下tab会补完到default,光标显示在switch后的变量这时输入枚举,输完后回车,自动补完所有枚举的case
- RestTemplate中headers中添加Host不生效
在使用restTemplate访问内网接口时,不打算指host,支持ip访问,所以我们需要再header中指定host.但经调试,发现HttpURLConnection中Host无法覆盖.解决方案: ...
- Git学习三
一.准备Github远程仓库 1.github官网注册账户 2.ubuntu端创建SSH Key $ssh-keygen -t rsa -C "youremail@example.com&q ...
- centos7开启路由转发
centos7开启路由转发 编辑/etc/sysctl.conf,添加一下内容. vim /etc/sysctl.conf net.ipv4.ip_forward=1 net.ipv4.conf.al ...
- [Usaco2006 Open]The Climbing Wall 攀岩
Description One of the most popular attractions at the county fair is the climbing wall. Bessie want ...
- _bzoj1061 [Noi2008]志愿者招募【最小费用最大流】
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1061 尽管不是mcmf的裸题,但还是保存一下模版叭~ 很好的一道建模的题,把变量间的加加减减 ...
- 51nod1099 任务执行顺序
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int r,o; int s ...