<1 min read

BaseResultPreviousPrice

BaseResultPreviousPrice

Component that renders the @empathyco/x-types#Result previous price.

Props

Name Description Type Default
result (Required) The @empathyco/x-types#Result information. Result
format Format or mask to be defined as string.
- Use 'i' to define integer numbers.
- Use 'd' to define decimal numbers. You can define the length of the decimal part. If the
doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.
- Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.
- Decimal separator must be defined between the last 'i' and the first 'd'. It can be more
than one character.
- Set whatever you need around the integers and decimals marks.
string

Slots

Name Description Bindings
(name - type - description)
default Base currency item result result - Result data

Examples

Basic example

This component shows the previous price formatted if it has discount. The component has two optional props. format to select the currency format to be applied.

<template>
  <BaseResultPreviousPrice :result="result" :format="'i.iii,ddd €'" />
</template>
<script>
  import { BaseResultPreviousPrice } from '@empathyco/x-components';
  export default {
    name: 'BaseResultPreviousPriceDemo',
    components: {
      BaseResultPreviousPrice
    }
  };
</script>

Overriding default slot

<template>
  <BaseResultPreviousPrice :result="result">
    <span class="custom-base-result-previous-price">{{ result.price.originalValue }}</span>
  </BaseResultPreviousPrice>
</template>
<script>
  import { BaseResultPreviousPrice } from '@empathyco/x-components';
  export default {
    name: 'BaseResultPreviousPriceDemo',
    components: {
      BaseResultPreviousPrice
    }
  };
</script>