You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
476 B
23 lines
476 B
import React, { Component } from 'react';
|
|
|
|
// 登录后才能跳转
|
|
class LinkAfterLogin extends Component {
|
|
|
|
constructor(props) {
|
|
super(props);
|
|
}
|
|
checkAuth = () => {
|
|
if (this.props.checkIfLogin()) {
|
|
this.props.history.push(this.props.to)
|
|
} else {
|
|
this.props.showLoginDialog()
|
|
}
|
|
}
|
|
render() {
|
|
return(
|
|
<a {...this.props} onClick={this.checkAuth}>{this.props.children}</a>
|
|
)
|
|
}
|
|
}
|
|
|
|
export default LinkAfterLogin; |