Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/guides/basics/RouteMatching.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ React Router 使用路由嵌套的概念来让你定义 view 的嵌套集合,

- `:paramName` – 匹配一段位于 `/`、`?` 或 `#` 之后的 URL。 命中的部分将被作为一个[参数](/docs/Glossary.md#params)
- `()` – 在它内部的内容被认为是可选的
- `?` -内容是可选的
- `*` – 匹配任意字符(非贪婪的)直到命中下一个字符或者整个 URL 的末尾,并创建一个 `splat` [参数](/docs/Glossary.md#params)
- `**` - 匹配任意字符(贪婪的)直到命中下一个字符 `/`、`?` 或 `#`,并创建一个 `splat` [参数](/docs/Glossary.md#params)

```js
<Route path="/hello/:name"> // 匹配 /hello/michael 和 /hello/ryan
<Route path="/hello(/:name)"> // 匹配 /hello, /hello/michael 和 /hello/ryan
<Route path="hello/:name?"> // 4.0以后 应该这样写 匹配/hello, /hello/michael 和 /hello/ryan
<Route path="/files/*.*"> // 匹配 /files/hello.jpg 和 /files/path/to/hello.jpg
```

Expand Down