Search

Search by
Other Options
Result count limit
Limit the number of results shown.

Results

Result Count: 0
No results

Source Data

  1. First name: Roslyn
    Last name: Mitchell
  2. First name: Cathleen
    Last name: Matthews
  3. First name: Carleton
    Last name: Harrelson
  4. First name: Allen
    Last name: Moores
  5. First name: John
    Last name: Washington
  6. First name: Brooke
    Last name: Colton
  7. First name: Mary
    Last name: Rennold
  8. First name: Nanny
    Last name: Field
  9. First name: Chasity
    Last name: Michael
  10. First name: Oakley
    Last name: Giles
  11. First name: Johanna
    Last name: Shepherd
  12. First name: Maybelle
    Last name: Wilkie
  13. First name: Dawson
    Last name: Rowntree
  14. First name: Manley
    Last name: Pond
  15. First name: Lula
    Last name: Sawyer
  16. First name: Hudson
    Last name: Hext
  17. First name: Alden
    Last name: Senior
  18. First name: Tory
    Last name: Hyland
  19. First name: Constance
    Last name: Josephs
  20. First name: Larry
    Last name: Kinsley

TIP

available in add-on @vueuse/integrations

useFuse

Easily implement fuzzy search using a composable on top of the zero-dependency library Fuse.js.

From the Fuse.js website:

What is fuzzy searching?

Generally speaking, fuzzy searching (more formally known as approximate string matching) is the technique of finding strings that are approximately equal to a given pattern (rather than exactly).

Install Fuse.js as a peer dependency

NPM

npm install fuse.js

Yarn

yarn add fuse.js

Usage

import { ref } from 'vue'
import { useFuse } from '@vueuse/integrations/useFuse'

const data = [
  'John Smith',
  'John Doe',
  'Jane Doe',
  'Phillip Green',
  'Peter Brown',
]

const input = ref('Jhon D')

const { results } = useFuse(input, data)

/*
 * Results:
 *
 * { "item": "John Doe", "index": 1 }
 * { "item": "John Smith", "index": 0 }
 * { "item": "Jane Doe", "index": 2 }
 *
 */

Type Declarations

export declare type FuseOptions<T> = Fuse.IFuseOptions<T>
export declare type UseFuseOptions<T> = {
  fuseOptions?: FuseOptions<T>
  resultLimit?: number
  matchAllWhenSearchEmpty?: boolean
}
export declare function useFuse<DataItem>(
  search: MaybeRef<string>,
  data: MaybeRef<DataItem[]>,
  options?: MaybeRef<UseFuseOptions<DataItem>>
): {
  results: ComputedRef<Fuse.FuseResult<DataItem>[]>
}
export declare type UseFuseReturn = ReturnType<typeof useFuse>

Source

SourceDemoDocs