Search
Results
Result Count: 0
No results
Source Data
- First name: Roslyn
Last name: Mitchell - First name: Cathleen
Last name: Matthews - First name: Carleton
Last name: Harrelson - First name: Allen
Last name: Moores - First name: John
Last name: Washington - First name: Brooke
Last name: Colton - First name: Mary
Last name: Rennold - First name: Nanny
Last name: Field - First name: Chasity
Last name: Michael - First name: Oakley
Last name: Giles - First name: Johanna
Last name: Shepherd - First name: Maybelle
Last name: Wilkie - First name: Dawson
Last name: Rowntree - First name: Manley
Last name: Pond - First name: Lula
Last name: Sawyer - First name: Hudson
Last name: Hext - First name: Alden
Last name: Senior - First name: Tory
Last name: Hyland - First name: Constance
Last name: Josephs - First name: Larry
Last name: Kinsley
TIP
available in add-on @vueuse/integrations
useFuse
Reactive wrapper for Fuse.js.
Install
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>