Components

<AisCurrentRefinements>

Current refinements widget

Usage

MySearchExperience.vue
<template>
  <div>
    <AisInstantSearch :widgets :configuration>
      <AisCurrentRefinements id="shipping">
        <template v-slot="{ items, createURL }">
          <ul>
            <li v-for="item in items" :key="item.attribute">
              {{ item.label }}:
              <ul>
                <li
                  v-for="refinement in item.refinements"
                  :key="[
                    refinement.attribute,
                    refinement.type,
                    refinement.value,
                    refinement.operator
                  ].join(':')"
                >
                  <a
                    :href="createURL(refinement)"
                    @click.prevent="item.refine(refinement)"
                  >
                    {{ refinement.label }} X
                  </a>
                </li>
              </ul>
            </li>
          </ul>
        </template>
      </AisCurrentRefinements>
    </AisInstantSearch>
  </div>
</template>

<script setup lang="ts">
const widgets = computed(() => [useAisCurrentRefinements({
  included-attributes: ['free_shipping']
  // excluded-attributes: ['...']
  id: 'shipping'
})]
</script>
⚠️ Always setting ID to widget and component's prop if you use more CurrentRefinements components inside the same index
⚠️ This component does not allow the simultaneous use of the included-attributes and excluded-attributes props

Slots, props and widget connector params are all typed! More thorough documentation coming soon :)


Copyright © 2023