博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
基于React的Tab组件
阅读量:7040 次
发布时间:2019-06-28

本文共 1208 字,大约阅读时间需要 4 分钟。

基于React的Tab组件

Tabs

renderHeader = () => {    return React.Children.map( this.props.children , (element,index) => {      const activeStyle = element.key === this.state.activeKey ? "activeTitle" : null;      return (           {                this.setState({                  activeKey: element.key                })              }}              className={classnames("title", activeStyle)}          >            {element.props.title}                )    })  }  renderContent = () => {    return React.Children.map( this.props.children , (element,index) => {      if (element.key === this.state.activeKey) {        return (
{element.props.children}
) } }) } render() { return (
{this.renderHeader()}
{this.renderContent()}
) }

TabPane

render() {    return (        
{this.props.title}
{this.props.children}
) }

调用

render() {    return (        
content1
content2
) }

转载于:https://www.cnblogs.com/simply-yu/p/9425112.html

你可能感兴趣的文章
mysql优化 慢查询(一)
查看>>
hdu4288 Coder(段树+分离)
查看>>
自定义控件 --- 加载旋转图标
查看>>
(算法)最长不重复子串
查看>>
iOS Version 和 Build 版本号
查看>>
准备.Net转前端开发-WPF界面框架那些事,搭建基础框架
查看>>
MVC中实现加载更多
查看>>
最全面的CleanMyMac使用方法
查看>>
HTTP 304
查看>>
基于OBS的插件开发总结
查看>>
详解.NET IL代码
查看>>
mongodb.conf配置文件详解
查看>>
(三)Boost库之字符串处理
查看>>
LoadRunner替换字符串(可以同时替换多个)
查看>>
静电的ui教程
查看>>
再谈最大似然估计与最小二乘
查看>>
PHP5各个版本的新功能和新特性总结
查看>>
http://www.tuicool.com/articles/B3qeUrB
查看>>
java 解析四则混合运算表达式并计算结果
查看>>
PulsingHalo(自定义涟漪)的使用方法
查看>>