提交 3de7475c 编写于 作者: D DCloud_LXH

update: searchBox

上级 b31c5ea5
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
spellcheck="false" spellcheck="false"
@input="query = $event.target.value" @input="query = $event.target.value"
@focus="focused = true" @focus="focused = true"
@blur="focused = true" @blur="focused = false"
@keyup.enter="go(focusIndex)" @keyup.enter="go(focusIndex)"
@keyup.up="onUp" @keyup.up="onUp"
@keyup.down="onDown" @keyup.down="onDown"
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
style="z-index: 1" style="z-index: 1"
@mouseleave="unfocus" @mouseleave="unfocus"
> >
<template v-if="this.suggestions && this.suggestions.length">
<li <li
v-for="(s, i) in suggestions" v-for="(s, i) in suggestions"
:key="i" :key="i"
...@@ -38,6 +39,12 @@ ...@@ -38,6 +39,12 @@
</div> </div>
</a> </a>
</li> </li>
</template>
<li v-else class="suggestion">
<div class="suggestion-item">
<span class="page-title">暂无结果</span>
</div>
</li>
</ul> </ul>
</div> </div>
</template> </template>
...@@ -62,7 +69,7 @@ ...@@ -62,7 +69,7 @@
computed: { computed: {
showSuggestions() { showSuggestions() {
return this.focused && this.suggestions && this.suggestions.length; return this.focused && this.query && this.query.length; // && this.suggestions && this.suggestions.length;
}, },
suggestions() { suggestions() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册