Appearance
useProductSearchSuggest
Definition
Composable for product suggest search.
Basic usage
ts
const {
searchTerm,
loading,
getProducts,
getTotal,
search,
loadMore
} = useProductSearchSuggest();
Signature
ts
export function useProductSearchSuggest(): UseProductSearchSuggestReturn
Return type
See UseProductSearchSuggestReturn
ts
export type UseProductSearchSuggestReturn = {
/**
* Current search term
*/
searchTerm: Ref<string>;
/**
* Indicates if the search is in progress
*/
loading: ComputedRef<boolean>;
/**
* Performs the search
* @param additionalCriteria - additional search criteria of type {@link ShopwareSearchParams}
* @returns
*/
search(additionalCriteria?: Partial<ShopwareSearchParams>): Promise<void>;
/**
* Loads more products for current search criteria
*/
loadMore(): Promise<void>;
/**
* Returns the product list found by the search
*/
getProducts: ComputedRef<Product[]>;
/**
* Returns the total number of products found by the search
*/
getTotal: ComputedRef<number>;
};
Properties
Name | Type | Description |
---|---|---|
searchTerm | Ref<string> | Current search term |
loading | ComputedRef<boolean> | Indicates if the search is in progress |
getProducts | ComputedRef<Array<Product>> | Returns the product list found by the search |
getTotal | ComputedRef<number> | Returns the total number of products found by the search |
Methods
Name | Type | Description |
---|---|---|
search | Promise<void> | Performs the search |
loadMore | Promise<void> | Loads more products for current search criteria |