this is my code
<template>
<div id="app-search">
<ais-instant-search :search-client="searchClient" index-name="demo_ecommerce">
<ais-search-box />
<ais-hits>
<template v-slot:item="{ item }">
<h2>{{ item.name }}</h2>
</template>
</ais-hits>
</ais-instant-search>
</div>
</template>
<script>
import algoliasearch from 'algoliasearch/lite'
export default {
data() {
return {
searchClient: algoliasearch(
'B1G2GM9NG0',
'aadef574be1f9252bb48d4ea09b5cfe5'
)
}
}
}
</script>
<style>
body {
font-family: sans-serif;
padding: 1em;
}
</style>
and the final html is
<div class="ais-InstantSearch">
<div class="ais-SearchBox"></div>
<div class="ais-Hits">
<ol class="ais-Hits-list">
<li class="ais-Hits-item">
<h2>AT&T GoPhone - Samsung Galaxy Express 3 4G LTE with 8GB Memory Prepaid Cell Phone</h2>
</li>
...
</ol>
</div>
</div>
i have tried with a new vue project demo,and it work fine,i don’t known why i put the same code in my previous project, the ais-SearchBox doen’t work
New contributor
poorops is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.