UNPKG

joywok-material-components

Version:

<h1 align="center"> Joywok Material Components </h1>

50 lines (48 loc) 1.11 kB
import React , {Component,Fragment} from 'react'; import {connect} from 'dva'; import JwTabs from '../tabs/index' import JwTab from '../tabs/tab' import { withStyles } from '@material-ui/core/styles'; require('./style/index.css'); let styles = theme =>({ root:{ color:'#333333' }, tab:{ color: '#b0b0b0', fontSize:14, minWidth:50 } }); class Tabs extends React.Component{ constructor(props) { super(props); this.state = { } } handleChange(event,value){ let data = this.props; let nowData = _.findWhere(this.props.options,{value:value}); this.props.onChange && this.props.onChange(nowData); } render(){ let self = this; let data = this.props; return( <JwTabs onChange={(e,value)=>this.handleChange(e,value)} value={data['value']} className={self.props.classes.root} textColor="primary" > { _.map(this.props.options,function(i){ return <JwTab label={i["label"]} value={i['value']} classes={{ }}/> }) } </JwTabs> ) } } export default withStyles(styles)(Tabs);