笔记
只有在 router.js 定义使用的 component 对应的 component 才能从组件的 props 中提取到 history 属性
要解决这个问题的话, 对应的组件要使用react-router-dom 的高阶组件 withRouter, 导出时用 withRouter(ComponentName) 包裹
注意点: dva中使用 withRouter 要从dva的router库导入, 路径为 ‘dva/router’
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Kwin 's Blog!
评论