This commit is contained in:
2022-08-23 00:54:34 +08:00
parent 7f7a15be89
commit 5f9b4d50b9
5 changed files with 34 additions and 5 deletions
+19
View File
@@ -0,0 +1,19 @@
1、react-router-dom
2、BrowserRouter HashRouter 标签
3、路由组件与一般组件的区别
4、Route标签 路由组件
5、NavLink标签 高亮效果
6、activeClassName 自定义高亮路由类名
7、批量接收props {...this.props}
8、children相当于标签体内容
9、Switch to只匹配path一次,可以提高效率
<NavLink to='/home'>编程式路由</NavLink>
<Route path="/home" component={Home}/>
<Route path="/home" component={Test1}/>
此时 to同时匹配 home和test1路由组件 使用Switch标签后只匹配第一个
10、exact属性严格匹配 to匹配path
<Route exact={true} path="/test" component={Test}/> to='/test/a/b' 此时to不能匹配path
<Route exact={false} path="/test" component={Test}/> to='/test/a/b' 此时可以匹配path
11、Redict重定向 兜底