我正在渲染中使用此代码来显示标题。需要移动此逻辑来装入事件。如何实现。
render() {
const viewPage = this.props.history.location.pathname.includes("/app/accountManagers/view/")
const editPage = this.props.history.location.pathname.includes("/app/accountManagers/edit/")
const newPage = this.props.history.location.pathname.includes("/app/accountManagers/new/")
return (<div >
<div className="app-wrapper">
<ContainerHeader match={this.props.match} title={<IntlMessages id={editPage ? "DIC_ADMIN_SETTINGS_ACCOUNT_MANAGERS_EDIT_MANAGER" : newPage ? "DIC_ADMIN_SETTINGS_ACCOUNT_MANAGERS_NEW_MANAGER" : "DIC_ADMIN_SETTINGS_ACCOUNT_MANAGERS_VIEW_MANAGER"} />} />
</div>
componentDidMount(){
const viewPage = this.props.history.location.pathname.includes("/app/accountManagers/view/")
const editPage = this.props.history.location.pathname.includes("/app/accountManagers/edit/")
const newPage = this.props.history.location.pathname.includes("/app/accountManagers/new/")
return(
<div>
<div className="app-wrapper">
<ContainerHeader match={this.props.match} title={
<IntlMessages id={editPage ?
"DIC_ADMIN_SETTINGS_ACCOUNT_MANAGERS_EDIT_MANAGER" : newPage ?
"DIC_ADMIN_SETTINGS_ACCOUNT_MANAGERS_NEW_MANAGER" :
"DIC_ADMIN_SETTINGS_ACCOUNT_MANAGERS_VIEW_MANAGER"}
/>
}
/>
</div>
)
}