index.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <!-- 进度条 -->
  2. <template>
  3. <div :class="{'pa-3': pa, 'd-flex': inlineDisplay, 'white-bgc': whiteBgc}">
  4. <div :style="`font-size: ${props.fontSize || 13}px;`">{{ props.label }}</div>
  5. <div class="d-flex align-center" :class="inlineDisplay ? 'ml-2' : 'mt-1'" style="flex: 1;">
  6. <v-progress-linear
  7. :bg-color="barBgColor"
  8. :color="props.barColor"
  9. :height="props.barHeight"
  10. :model-value="props.num"
  11. :rounded="props.rounded"
  12. :max="props.total"
  13. min="0"
  14. ></v-progress-linear>
  15. <div
  16. v-if="props.total !== 0"
  17. class="ms-4 text-h7"
  18. :style="`font-size: ${props.fontSize || 13}px; color: ${props.percentageColor || '#000'}`"
  19. >{{ Number.isInteger(props.num/props.total*100) ? (props.num/props.total*100) : (props.num/props.total*100).toFixed(2) }}%</div>
  20. </div>
  21. </div>
  22. </template>
  23. <script setup>
  24. defineOptions({name: 'ProgressBar-index'})
  25. const props = defineProps({
  26. num: { type: Number, default: 1 },
  27. total: { type: Number, default: 2 },
  28. barHeight: { type: Number, default: 6 },
  29. fontSize: { type: Number, default: 13 },
  30. barColor: { type: String, default: 'var(--v-primary-base)' },
  31. barBgColor: { type: String, default: '#92aed9' },
  32. percentageColor: { type: String, default: '#000' },
  33. rounded: { type: Boolean, default: true },
  34. label: { type: String, default: '简历完成度' },
  35. // list: { type: Array, default: () => [] },
  36. inlineDisplay: { type: Boolean, default: false },
  37. whiteBgc: { type: Boolean, default: true },
  38. pa: { type: Boolean, default: true },
  39. })
  40. </script>
  41. <style lang="scss" scoped>
  42. </style>