1. npm install prop-types
2.在组件文件中
import PropTypes from 'prop-types';
3.组件内
static contextTypes = {
router: PropTypes.object
}
4.触发事件中路由跳转
this.context.router.history.push(url)
1. npm install prop-types
2.在组件文件中
import PropTypes from 'prop-types';
3.组件内
static contextTypes = {
router: PropTypes.object
}
4.触发事件中路由跳转
this.context.router.history.push(url)