单击“登录”按钮后如何导航到新页面。我想创建一个这样做的功能

时间:2018-10-19 20:33:35

标签: reactjs dom router

我想做到这一点,因此在单击onClick之后,它将带我到另一个页面。当我指定浏览器的路径时,我可以浏览页面,但是,我想知道如何通过按我正在使用“ React Router Dom”的登录按钮来做到这一点。

从“反应”中导入React,{Component};     导入“ ./App.css”;

class Login extends Component {

    onClick=()=> {

    }
render() {



    return(
        <div style={{marginTop:-22}}>
            <div style={{backgroundImage:"url(https://freeios7.com/download/freeios7.com_apple_wallpaper_peach-grass-blur_iphone4.jpg)", height:900, width:1900}}>
            <div style={{display:"flex", flexDirection:"column", alignItems:"center", paddingTop:65}}>
            <div style={{display:"flex", flexDirection:"column", alignItems:"flex-end"}}>
            </div>
            <img src="https://www.moonlight.com.au/wp-content/themes/moonlight-2016/dist/images/moonlight-logo.png"/>
            </div>
        <div className="login-contents">
            <h1>Email</h1>
            <input 
                className="inputdesign"
                placeholder="Enter Email"/>
            <h1>Password</h1>
            <input
            className="inputdesign"
                placeholder="Enter Password" />
                <div style={{paddingTop:20}}>
                <button onClick={this.onClick} className="loginbutton">Login</button>
                </div>
                <div className="loginhelp">
                <div>New to Moonlight Cinema? Create Account</div>
                <div>Forgot Password?</div>
                </div>
            </div>
            </div>
        </div>
    )
}
}



export default Login;

请帮助。谢谢!

0 个答案:

没有答案