docs: invalid <p> for route params (#9455)

Signed-off-by: Rongrong <15956627+Rongronggg9@users.noreply.github.com>
This commit is contained in:
Rongrong
2022-04-04 20:43:45 +08:00
committed by GitHub
parent cf8cb29a14
commit 19608abd31
2 changed files with 8 additions and 6 deletions

View File

@@ -15,7 +15,8 @@
<div v-if="path.match(/:.*?(\/|$)/g)">
<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> </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>
</div>
<div v-else><p>参数: </p></div>
<slot></slot>
@@ -70,11 +71,11 @@ export default {
},
},
methods: {
renderMarkdown(item) {
renderMarkdown(item, inline = true) {
const md = require('markdown-it')({
html: true,
});
return md.render(item);
return inline ? md.renderInline(item) : md.render(item);
},
},
computed: {