MiniProgress.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <div class="chart-mini-progress">
  3. <div class="target" :style="{ left: target + '%'}">
  4. <span :style="{ backgroundColor: color }" />
  5. <span :style="{ backgroundColor: color }"/>
  6. </div>
  7. <div class="progress-wrapper">
  8. <div class="progress" :style="{ backgroundColor: color, width: percentage + '%', height: height }"></div>
  9. </div>
  10. </div>
  11. </template>
  12. <script>
  13. export default {
  14. name: 'MiniProgress',
  15. props: {
  16. target: {
  17. type: Number,
  18. default: 0
  19. },
  20. height: {
  21. type: String,
  22. default: '10px'
  23. },
  24. color: {
  25. type: String,
  26. default: '#13C2C2'
  27. },
  28. percentage: {
  29. type: Number,
  30. default: 0
  31. }
  32. }
  33. }
  34. </script>
  35. <style lang="less" scoped>
  36. .chart-mini-progress {
  37. padding: 5px 0;
  38. position: relative;
  39. width: 100%;
  40. .target {
  41. position: absolute;
  42. top: 0;
  43. bottom: 0;
  44. span {
  45. border-radius: 100px;
  46. position: absolute;
  47. top: 0;
  48. left: 0;
  49. height: 4px;
  50. width: 2px;
  51. &:last-child {
  52. top: auto;
  53. bottom: 0;
  54. }
  55. }
  56. }
  57. .progress-wrapper {
  58. background-color: #f5f5f5;
  59. position: relative;
  60. .progress {
  61. transition: all .4s cubic-bezier(.08,.82,.17,1) 0s;
  62. border-radius: 1px 0 0 1px;
  63. background-color: #1890ff;
  64. width: 0;
  65. height: 100%;
  66. }
  67. }
  68. }
  69. </style>