import React from 'react'; import { Link } from 'react-router-dom'; import './index.less'; function getItem(props, item, onChange) { const { width, space, active } = props; return (
active !== item.key && onChange && onChange(item.key)} style={{ width: width || '', marginLeft: space || '', marginRight: space || '' }} className={`tab ${active === item.key ? 'active' : ''}`} > {item.name}
); } function Tabs(props) { const { tabs = [], type = 'line', border, onChange } = props; return (
{tabs.map(item => { return item.path ? {getItem(props, item)} : getItem(props, item, onChange); })}
); } Tabs.propTypes = {}; export default Tabs;