owntone-server/web-src/src/components/ProgressBar.vue

27 lines
428 B
Vue
Raw Normal View History

2022-02-19 00:18:01 -05:00
<template>
<div
v-if="width > 0"
class="progress-bar"
:style="{ width: width_percent }"
/>
2022-02-19 00:18:01 -05:00
</template>
<script>
export default {
name: 'ProgressBar',
props: ['max', 'value'],
computed: {
width() {
2022-02-19 00:18:01 -05:00
if (this.value > 0 && this.max > 0) {
return parseInt((this.value * 100) / this.max)
2022-02-19 00:18:01 -05:00
}
return 0
},
width_percent() {
2022-02-19 00:18:01 -05:00
return this.width + '%'
}
}
}
</script>