parent
8960cc6216
commit
5fdbbcd319
@ -0,0 +1,23 @@
|
|||||||
|
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;
|
Loading…
Reference in new issue