File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -14,12 +14,14 @@ React Router 使用路由嵌套的概念来让你定义 view 的嵌套集合,
1414
1515 - ` :paramName ` – 匹配一段位于 ` / ` 、` ? ` 或 ` # ` 之后的 URL。 命中的部分将被作为一个[ 参数] ( /docs/Glossary.md#params )
1616 - ` () ` – 在它内部的内容被认为是可选的
17+ - ` ? ` -内容是可选的
1718 - ` * ` – 匹配任意字符(非贪婪的)直到命中下一个字符或者整个 URL 的末尾,并创建一个 ` splat ` [ 参数] ( /docs/Glossary.md#params )
1819 - ` ** ` - 匹配任意字符(贪婪的)直到命中下一个字符 ` / ` 、` ? ` 或 ` # ` ,并创建一个 ` splat ` [ 参数] ( /docs/Glossary.md#params )
1920
2021``` js
2122< Route path= " /hello/:name" > // 匹配 /hello/michael 和 /hello/ryan
2223< Route path= " /hello(/:name)" > // 匹配 /hello, /hello/michael 和 /hello/ryan
24+ < Route path= " hello/:name?" > // 4.0以后 应该这样写 匹配/hello, /hello/michael 和 /hello/ryan
2325< Route path= " /files/*.*" > // 匹配 /files/hello.jpg 和 /files/path/to/hello.jpg
2426```
2527
You can’t perform that action at this time.
0 commit comments