AndyJames
10/2/2019 - 10:08 PM

Button Range Filter - For manual ranges

<div class="ss-component">
  <h1>Range</h1>
  <p>Single Range Buttons that define a range search</p>
  <div class="filter-button">
    <a
      fs-fields="dailyPrice"
      fs-lte="99"
      fs-gte="50"
      :class="{'active': rangeActive('filter4', '99')}"
      v-on:click="buttonRangeFilter( 'filter4', $event)"
    >$50 to $100</a>
  </div>
  <div class="filter-button">
    <a
      fs-fields="dailyPrice"
      fs-lte="150"
      fs-gte="100"
      :class="{'active': rangeActive('filter4', '150')}"
      v-on:click="buttonRangeFilter( 'filter4', $event)"
    >$100 to $150</a>
  </div>
</div>
/**
 * Submits a button filter search for a range
 *
 * @param {$event} event Accepts html event
 * @param {*} model filter1 - filter10 & must be unique
 */
buttonRangeFilter(model, event) 
/**
 * Set the class active if model value === lte
 *
 * @param {*} model to bind to
 * @param {*} check is an object to check for eg: {'gte': '500'} 
 * @returns
 */
rangeActive(model, check)

Notes

You can use

Use one or combine them

Use one for a one way range or both for a more specific range between 2 values

fs-lte="value" fs-gt="value" fs-lt="value" fs-gt="value"

Active class

:class="{'active': rangeActive('filter11', {'gte': '500'})}"

Takes the model name and an object with an evaluation to check to set active

Above example will be active when evaluation of gte = 500