我想弄清楚如何在空搜索查询中隐藏索引/结果。
在我的刀片中,我有代码(从官方文档略有修改):
<ais-instant-search index-name="myIndex" :search-client="searchClient">
<ais-search-box placeholder="Search here"></ais-search-box>
<ais-state-results>
<template slot-scope="{ state: { query } }">
<ais-hits v-if="query.length > 0">
<div slot="item" slot-scope="{ item }">
<h2>@{{ item.Title}}</h2>
<p>@{{ item.Text}}</p>
</div>
</ais-hits>
</template>
</ais-state-results>
</ais-instant-search>
如果我输入搜索查询,这可以正常工作,但在空查询时,这会在我的页面上显示以下不需要的通知(而不是之前不需要的索引):
Use this component to have a different layout based on a certain state.
Fill in the slot, and get access to the following things on the slot-scope:
results: [
"_rawResults",
"hits",
"nbHits",
[..]
如何隐藏此通知?