import './Header.scss' import React, { Component } from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' import { Link } from 'react-router-dom' import { Icon, Layout, Menu} from 'antd' import loginTypeAction from '../../actions/login'; const { Header } = Layout; const ToolUser = (props)=> ( ); ToolUser.propTypes={ user:PropTypes.string, msg:PropTypes.string }; const ToolGuest = (props)=> ( ); ToolGuest.propTypes={ onLogin:PropTypes.func, onReg:PropTypes.func } class HeaderCom extends Component { constructor(props) { super(props); } handleLogin = (e) => { e.preventDefault(); this.props.loginTypeAction("1"); } handleReg = (e)=>{ e.preventDefault(); this.props.loginTypeAction("2"); } render () { const { login, user, msg } = this.props; return (
YAPI
首页 分组 文档
{login?:''}
) } } HeaderCom.propTypes={ user: PropTypes.string, msg: PropTypes.string, login:PropTypes.bool, loginTypeAction:PropTypes.func }; export default connect( (state) => { return{ user: state.login.userName, msg: "暂无消息", login:state.login.isLogin } }, {loginTypeAction} )(HeaderCom)