JLStats
Provides a widget that displays numeric data (count visitors, total revenue, product share) with additional delta change value.
Props
value
- main value to display, optionaly with a sign ($100, 50%, etc)delta
- delta value to display, optionaly with a sign (+10%, -50 ppl, etc)endpoint
- URL to load datadynamicData
- boolean, activatesendpoint
for loading dataanimated
- boolean, add animation for a number
For value
and delta
data consists of following fields:
value
- actual main number to displayvalueMeasurement
- parameter that is displayed,signOnTheLeft
- boolean, on which side of thevalue
the sign should be shownvalueSign
- actual value sign, e.g.$
,%
etc
Example
<script lang="ts" setup>
import { JLStats } from '@juicyllama/frontend-core'
const inputStatic = ref({
title: 'Website visitor using mobile',
value: {
value: 4964,
valueMeasurement: '',
signOnTheLeft: false,
valueSign: '',
},
delta: {
value: 428,
valueMeasurement: '',
signOnTheLeft: true,
valueSign: '-',
},
})
const inputWithAPIEndpoint = ref({
endpoint: '/api/users/stats',
dynamicData: true,
})
</script>
<template>
<!--Stats widget from local data-->
<JLStats v-bind="inputStatic" />
<!--Stats widget from API data-->
<JLStats v-bind="inputWithAPIEndpoint" />
</template>