docs: support parameter suffix * (#7946)

* docs: support parameter suffix `*`

`*` denotes a zero or more parameter matches, so the parameter including `*` is optional. (https://github.com/pillarjs/path-to-regexp#zero-or-more)

* docs: mention the parameter suffix `*`

* docs: support parameter suffix `+`

* docs: add document of parameter suffixs

* docs: fix having / at the end of parameter

* docs: add missing changes in en docs

* docs: typo

Co-authored-by: TonyRL <TonyRL@users.noreply.github.com>
This commit is contained in:
Hagb (Junyu Guo 郭俊余)
2022-05-07 17:18:35 +08:00
committed by GitHub
parent 2441ef91f0
commit eb79456f40
6 changed files with 11 additions and 9 deletions

View File

@@ -16,7 +16,7 @@
<p>
参数:
</p>
<ul><li class="params" v-for="(item, index) in path.match(/:.*?(\/|$)/g)"><code>{{item.replace(':','').replace('/','').replace('?','')}}</code>, {{(item.includes('?'))?'可选':'必选'}} - <span v-html="renderMarkdown(paramsDesc[index])"></span></li></ul>
<ul><li class="params" v-for="(item, index) in path.match(/:.*?(\/|$)/g)"><code>{{item.replace(/:|\?|\+|\*|\//g,'')}}</code>, {{{'?':'可选','*':'零个或多个','+':'单个或多个'}[item[item.length-1]]||'必选'}} - <span v-html="renderMarkdown(paramsDesc[index])"></span></li></ul>
</div>
<div v-else><p>参数: </p></div>
<slot></slot>