Progress 进度

Scan me!

进度圆环,用于将数据直观地传达给用户

引入

  1. import { Progress } from 'mand-mobile'
  2. Vue.component(Progress.name, Progress)

代码演示

基本

Progress 进度 - 图2

  1. <template>
  2. <div class="md-example-child md-example-child-progress">
  3. <md-progress
  4. :size="100"
  5. :value="0.2"
  6. :width="5"
  7. >
  8. <span class="progress-value">20%</span>
  9. </md-progress>
  10. <md-progress
  11. :size="100"
  12. :value="0.5"
  13. :width="5"
  14. >
  15. <span class="progress-value">50%</span>
  16. </md-progress>
  17. <md-progress
  18. :size="100"
  19. :value="1"
  20. :width="5"
  21. >
  22. <span class="progress-value">100%</span>
  23. </md-progress>
  24. </div>
  25. </template>
  26. <script>
  27. import {Progress} from 'mand-mobile'
  28. export default {
  29. name: 'progress-demo',
  30. components: {
  31. [Progress.name]: Progress,
  32. },
  33. }
  34. </script>
  35. <style lang="stylus">
  36. .md-example-child-progress
  37. display flex
  38. justify-content center
  39. .md-progress
  40. margin 0 10px
  41. .progress-value
  42. font-size 24px
  43. font-family DINPro-Medium
  44. </style>
  45.  

其他配置

Progress 进度 - 图3

  1. <template>
  2. <div class="md-example-child md-example-child-progress">
  3. <md-progress
  4. :value="0.8"
  5. :width="10"
  6. :size="100"
  7. color="url(#linear)"
  8. border-color="#FFF"
  9. linecap="butt"
  10. >
  11. <span class="progress-value">80%</span>
  12. <defs slot="defs">
  13. <linearGradient id="linear" x1="0%" y1="0%" x2="100%" y2="0%">
  14. <stop offset="0%" stop-color="#FF5257"/>
  15. <stop offset="100%" stop-color="#FFC541D6"/>
  16. </linearGradient>
  17. </defs>
  18. </md-progress>
  19. <md-progress
  20. :value="0.8"
  21. :width="10"
  22. :size="100"
  23. :rotate="-90"
  24. color="#FF5257"
  25. transition
  26. >
  27. <span class="progress-value">
  28. <md-amount
  29. :value="80"
  30. :precision="0"
  31. transition
  32. ></md-amount>%
  33. </span>
  34. </md-progress>
  35. </div>
  36. </template>
  37. <script>
  38. import {Amount, Progress} from 'mand-mobile'
  39. export default {
  40. name: 'progress-demo',
  41. components: {
  42. [Amount.name]: Amount,
  43. [Progress.name]: Progress,
  44. },
  45. }
  46. </script>
  47. <style lang="stylus">
  48. .md-example-child-progress
  49. display flex
  50. justify-content center
  51. .md-progress
  52. margin 0 10px
  53. .progress-value
  54. font-size 24px
  55. font-family DINPro-Medium
  56. </style>
  57.  

API

Progress Props

属性说明类型默认值备注
value进度值Number00-1
size圆环大小Number70单位px
width圆环宽度Number-单位px
color圆环高亮颜色String#fc9153-
border-color圆环颜色Stringrgba(0, 0, 0, .1)-
fill圆环内部填充Stringtransparent-
linecap圆环两端形状Stringroundround, butt
rotate圆环旋转Number0-
transition进度变化是否使用动效Booleanfalse-
duration进度变化动效时长Number1000单位ms

Progress Slots

default

圆环内部内容插槽,一般用于添加文本

defs

圆环SVG内部的插槽,一般用于添加defs, use元素等