| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <template>
- <view class="quota-progress-bar" :style="{ '--font-scale': fontScale }">
- <view class="quota-label">
- <text class="quota-name">{{ name }}</text>
- <text class="quota-count">{{ remaining }} / {{ total }}</text>
- </view>
- <view class="quota-track">
- <view class="quota-fill" :style="{ width: percent + '%' }"></view>
- </view>
- </view>
- </template>
- <script>
- import fontScaleMixin from '@/mixins/font-scale.js'
- export default {
- mixins: [fontScaleMixin],
- name: 'QuotaProgressBar',
- props: {
- remaining: { type: Number, default: 0 },
- total: { type: Number, default: 0 },
- name: { type: String, default: '' }
- },
- computed: {
- percent() {
- if (!this.total) return 0
- return Math.round((this.remaining / this.total) * 100)
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .quota-progress-bar {
- margin-bottom: 16rpx;
- }
- .quota-label {
- display: flex;
- justify-content: space-between;
- font-size: calc(24rpx * var(--font-scale, 1));
- color: $facade-text-body;
- margin-bottom: 8rpx;
- }
- .quota-track {
- height: 12rpx;
- background: $facade-fill;
- border-radius: 8rpx;
- overflow: hidden;
- }
- .quota-fill {
- height: 100%;
- background: $brand-primary;
- border-radius: 8rpx;
- transition: width 0.3s;
- }
- </style>
|