Front-end/react/qf/3路由.md

26 lines
652 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

HashRouter路径中有#
BrowserRouter路径中无#
BrowserRouter as Router 可以将Router写在代码中。
BrowserRouter 没有#的路径好看真正朝后端发请求要页面后端没有对应的路径处理路径就回404不好看。
## 动态路由
```js
<Router path="/detail/:myid" component={Detail}/>
props.match.params.myid
```
## 路由拦截
![](img/路由拦截微信截图_20231215181801.png)
## 路由模式
## withRouter 包裹路由
## 反向代理
## CSSModule
.module.css 模块化css文件
import style from './css/film.module.css'
{style.clazz}
id选择器class选择器生效
标签选择器,不生效