UNPKG

gridsome-plugin-flexsearch

Version:

Add lightning fast search to Gridsome with FlexSearch

18 lines (17 loc) 331 B
export default { data: () => ({ searchTerm: '' }), computed: { searchResults () { const searchTerm = this.searchTerm if (searchTerm.length < 3) return [] return this.$search.search({ query: searchTerm, limit: 8 }) } }, watch: { $route (to, from) { this.searchTerm = '' } } }