Skip to main content

fdk-compare-action

You are reading an outdated document

Get the latest developer guides on Fynd Partners Help

This action component is used to add a particular product to compare on the compare page, product is added into the compare using its slug.

Props

KeyTypeDescription
addComparefunctionthis function is used to add the product into compare
removeComparefunctionthis function remove products from the compare and update the router while removing the product from it.
addMultipleComparefunctionthis function is used to add multiple prouducts into the compare at the same time.
navigateToComparefunctionthis function is used to update the router, while pushing the slugs of available products in comapre
resetComparefunctionthis function resets the compare by removing all the products from compare and updating the router while removing all the product slugs from it.

Functions

  • addCompare(slug)

Here slug is the product’s slug which needed to be added in compare

  • removeCompare(slug)

Here slug is the product’s slug which needed to be removed from compare

  • addMultipleCompare([slug1, slug2, slug3, ...])

Here array of multiple slug is passed as parameter.


Examples

<fdk-compare-action>
<template slot-scope="compare">
<div
@click="compare.addCompare(product.slug)"
>
<div class="compare-icon">
<img src="./../../../assets/images/compare-icon.png" alt />
</div>
<p>Add to Compare</p>
</div>
</template>
</fdk-compare-action>