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 } from 'antd' import loginTypeAction from '../../actions/login'; const ToolUser = (props)=> ( ); ToolUser.propTypes={ user:PropTypes.string, msg:PropTypes.string }; const ToolGuest = (props)=> ( ); ToolGuest.propTypes={ onLogin:PropTypes.func, onReg:PropTypes.func } class Header extends Component { constructor(props) { super(props); this.state={ guestToolShow:true } } handleLogin = (e) => { e.preventDefault(); this.props.loginTypeAction("1"); this.setState({ guestToolShow:false }) } handleReg = (e)=>{ e.preventDefault(); this.props.loginTypeAction("2"); this.setState({ guestToolShow:false }) } hideGuestTool = (e)=>{ e.preventDefault(); this.setState({ guestToolShow:true }) } render () { const { login, user, msg } = this.props; return (

YAPI

) } } Header.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} )(Header)