I am using ais-instant-search
and ais-state-results
to display my data. I hide the result until query.length > 0
. It works but if I don't enter any search string, it always shows a message. Below are my code and screenshot:
<ais-state-results>
<p slot-scope="{ query, hits }" v-if="!hits.length">
Not found for: <q>{{ query }}</q>
</p>
<template v-else slot-scope="{ query }">
<ais-hits v-if="query.length > 0">
<template slot="item"
slot-scope="{ item }"
>
<h1>
<ais-highlight
:hit="item"
attribute="name"
/>
</h1>
<ul>
<li>{{ item.price }}</li>
</ul>
</template>
</ais-hits>
</template>
</ais-state-results>