Appearance
useWishlist ​
Definition ​
Composable to manage wishlist
Basic usage ​
ts
const {
items,
count,
mergeWishlistProducts,
getWishlistProducts,
clearWishlist
} = useWishlist();
Signature ​
ts
export function useWishlist(): UseWishlistReturn
Return type ​
See UseWishlistReturn
ts
export type UseWishlistReturn = {
/**
* Merge products with wishlist between async (API) and sync (localstorage) wishlists
*/
mergeWishlistProducts(): void;
/**
* Get products list added to wishlist
*/
getWishlistProducts(): void;
/**
* Clear wishlist
*/
clearWishlist(): void;
/**
* Wishlist items (Product IDs)
*/
items: ComputedRef<string[]>;
/**
* Wishlist items count
*/
count: ComputedRef<number>;
};
Properties ​
Name | Type | Description |
---|---|---|
items | ComputedRef<Array<string>> | Wishlist items (Product IDs) |
count | ComputedRef<number> | Wishlist items count |
Methods ​
Name | Type | Description |
---|---|---|
mergeWishlistProducts | void | Merge products with wishlist between async (API) and sync (localstorage) wishlists |
getWishlistProducts | void | Get products list added to wishlist |
clearWishlist | void | Clear wishlist |