primevue-mirror/components/lib/progressbar/ProgressBar.vue

46 lines
1.4 KiB
Vue
Raw Normal View History

2022-09-06 12:03:37 +00:00
<template>
2023-12-05 09:49:37 +00:00
<div role="progressbar" :class="cx('root')" aria-valuemin="0" :aria-valuenow="value" aria-valuemax="100" v-bind="getPTOptions('root')">
<div v-if="determinate" :class="cx('value')" :style="progressStyle" v-bind="getPTOptions('value')">
<div v-if="value != null && value !== 0 && showValue" :class="cx('label')" v-bind="getPTOptions('label')">
2022-09-14 11:26:01 +00:00
<slot>{{ value + '%' }}</slot>
</div>
2022-09-06 12:03:37 +00:00
</div>
2023-12-05 09:49:37 +00:00
<div v-if="indeterminate" :class="cx('container')" v-bind="getPTOptions('container')">
<div :class="cx('value')" v-bind="getPTOptions('value')"></div>
2022-09-06 12:03:37 +00:00
</div>
</div>
</template>
<script>
2023-05-25 16:32:25 +00:00
import BaseProgressBar from './BaseProgressBar.vue';
2023-04-21 13:34:40 +00:00
2022-09-06 12:03:37 +00:00
export default {
name: 'ProgressBar',
2023-05-25 16:32:25 +00:00
extends: BaseProgressBar,
2023-12-05 09:49:37 +00:00
methods: {
getPTOptions(key) {
return this.ptm(key, {
parent: {
props: this.$parent?.$props,
state: this.$parent?.$data
}
});
}
},
2022-09-06 12:03:37 +00:00
computed: {
progressStyle() {
return {
width: this.value + '%',
display: 'flex'
};
},
indeterminate() {
return this.mode === 'indeterminate';
},
determinate() {
return this.mode === 'determinate';
}
}
2022-09-14 11:26:01 +00:00
};
2022-09-06 12:03:37 +00:00
</script>