摘要: 案例结合递归+遍历实现二级导航 import React from 'react' import { Menu, Icon } from 'antd'; import './index.less'; import MenuConfig from './../../config/menuconfig' 阅读全文
posted @ 2020-03-27 18:33 剑仙6 阅读(3570) 评论(0) 推荐(0) 编辑
摘要: 先使用withRouter对组件进行装饰然后就可以使用this.props.location.pathname获取到了例如: import React from 'react'; import { withRouter } from 'react-router-dom'; @withRouter e 阅读全文
posted @ 2020-03-27 17:04 剑仙6 阅读(5685) 评论(0) 推荐(0) 编辑
摘要: 作用: 默认情况下必须经过路由匹配渲染的组件才存在this.props,才拥有路由参数,执行this.props.history.push('/detail')跳转到对应路由的页面,然而不是所有组件都直接与路由相连(通过路由跳转到此组件)的,当这些组件需要路由参数时,使用withRouter就可以给 阅读全文
posted @ 2020-03-27 17:02 剑仙6 阅读(999) 评论(0) 推荐(0) 编辑
欢迎访问个人网站www.qingchun.在线