提交 c8de9eb9 编写于 作者: D DCloud_LXH

chore: 搜索结果添加 lvl2 描述

上级 3c80808d
...@@ -6,17 +6,13 @@ ...@@ -6,17 +6,13 @@
class="DocSearch-Hit-content-wrapper" class="DocSearch-Hit-content-wrapper"
v-if="item.hierarchy[item.type] && item.type === 'lvl1'" v-if="item.hierarchy[item.type] && item.type === 'lvl1'"
> >
<span class="DocSearch-Hit-title" v-html="snippetResultContent('hierarchy.lvl1')" /> <span class="DocSearch-Hit-title" v-html="hierarchyLvl1Html" />
<span <span v-if="item.content" class="DocSearch-Hit-path" v-html="contentHtml" />
v-if="item.content"
class="DocSearch-Hit-path"
v-html="snippetResultContent('content')"
/>
</div> </div>
<div v-else-if="isContent" class="DocSearch-Hit-content-wrapper"> <div v-else-if="isContent" class="DocSearch-Hit-content-wrapper">
<span class="DocSearch-Hit-title" v-html="snippetResultContent('content')" /> <span class="DocSearch-Hit-title" v-html="contentHtml" />
<span class="DocSearch-Hit-path" v-html="snippetResultContent('hierarchy.lvl1')" /> <span class="DocSearch-Hit-path" v-html="hierarchyLvl1Html || hierarchyLvl2Html" />
</div> </div>
<div v-else class="DocSearch-Hit-content-wrapper"> <div v-else class="DocSearch-Hit-content-wrapper">
...@@ -24,7 +20,7 @@ ...@@ -24,7 +20,7 @@
class="DocSearch-Hit-title" class="DocSearch-Hit-title"
v-html="snippetResultContent(`hierarchy.${item.type}`)" v-html="snippetResultContent(`hierarchy.${item.type}`)"
/> />
<span class="DocSearch-Hit-path" v-html="snippetResultContent('hierarchy.lvl1')" /> <span class="DocSearch-Hit-path" v-html="hierarchyLvl1Html" />
</div> </div>
</div> </div>
</a> </a>
...@@ -63,6 +59,16 @@ ...@@ -63,6 +59,16 @@
isContent() { isContent() {
return this.item.type === 'content'; return this.item.type === 'content';
}, },
contentHtml() {
return this.snippetResultContent('content');
},
hierarchyLvl1Html() {
return this.snippetResultContent('hierarchy.lvl1');
},
hierarchyLvl2Html() {
const lvl2 = this.snippetResultContent('hierarchy.lvl2');
return this.isContent ? this.contentHtml === lvl2 ? '' : lvl2 : '';
},
}, },
methods: { methods: {
snippetResultContent(attribute) { snippetResultContent(attribute) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册