用的官网的一个方法
const { route } = this.props
const { router } = this.context
router.setRouteLeaveHook(route, this.routerWillLeave.bind(this))
有个场景就是点回退的时候 需要触发 , 点击链接的时候跳转是不需要触发 , 现在react-router 这块是无法区分的,请问有什么办法区分吗?
用的官网的一个方法
const { route } = this.props
const { router } = this.context
router.setRouteLeaveHook(route, this.routerWillLeave.bind(this))
有个场景就是点回退的时候 需要触发 , 点击链接的时候跳转是不需要触发 , 现在react-router 这块是无法区分的,请问有什么办法区分吗?
你好 我想下您是怎么获取到this.props下的router的 我引入了widthRouter之后this.props里还是没有route