mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-11 16:28:37 +01:00
new selfhosted version
This commit is contained in:
19
dashboard/components/admin/MultipleProgress.vue
Normal file
19
dashboard/components/admin/MultipleProgress.vue
Normal file
@@ -0,0 +1,19 @@
|
||||
<script lang="ts" setup>
|
||||
|
||||
const props = defineProps<{ items: { value: number, color: string }[] }>();
|
||||
|
||||
function getPercent(index: number) {
|
||||
const total = props.items.reduce((a, e) => a + e.value, 0);
|
||||
const percent = 100 / total * props.items[index].value;
|
||||
return Math.ceil(percent);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex rounded-md overflow-hidden">
|
||||
<div :style="`width: ${getPercent(index)}%; background-color: ${props.items[index].color};`"
|
||||
v-for="(item, index) of props.items">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user