解决方案
在路由组件上最上层元素上加一个key增加路由的识别度 this.props.location.key
// 组件挂载
componentDidMount() {
console.log(this.props.location);
}
<div className={style.content} key={this.props.location.key}>
<CSSTransition
key={this.props.location.pathname}>
<Switch location={this.props.location}>
{routes.map(r => (
<Route key={r.key} supKey={r.supKey} path={r.path} exact={r.exact} component={r.component} />
))}
</Switch>
</CSSTransition>
</div>