Progress 进度
进度圆环,用于将数据直观地传达给用户
引入
import { Progress } from 'mand-mobile'
Vue.component(Progress.name, Progress)
代码演示
基本
<template>
<div class="md-example-child md-example-child-progress">
<md-progress
:size="100"
:value="0.2"
:width="5"
>
<span class="progress-value">20%</span>
</md-progress>
<md-progress
:size="100"
:value="0.5"
:width="5"
>
<span class="progress-value">50%</span>
</md-progress>
<md-progress
:size="100"
:value="1"
:width="5"
>
<span class="progress-value">100%</span>
</md-progress>
</div>
</template>
<script>
import {Progress} from 'mand-mobile'
export default {
name: 'progress-demo',
components: {
[Progress.name]: Progress,
},
}
</script>
<style lang="stylus">
.md-example-child-progress
display flex
justify-content center
.md-progress
margin 0 10px
.progress-value
font-size 24px
font-family DINPro-Medium
</style>
其他配置
<template>
<div class="md-example-child md-example-child-progress">
<md-progress
:value="0.8"
:width="10"
:size="100"
color="url(#linear)"
border-color="#FFF"
linecap="butt"
>
<span class="progress-value">80%</span>
<defs slot="defs">
<linearGradient id="linear" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" stop-color="#FF5257"/>
<stop offset="100%" stop-color="#FFC541D6"/>
</linearGradient>
</defs>
</md-progress>
<md-progress
:value="0.8"
:width="10"
:size="100"
:rotate="-90"
color="#FF5257"
transition
>
<span class="progress-value">
<md-amount
:value="80"
:precision="0"
transition
></md-amount>%
</span>
</md-progress>
</div>
</template>
<script>
import {Amount, Progress} from 'mand-mobile'
export default {
name: 'progress-demo',
components: {
[Amount.name]: Amount,
[Progress.name]: Progress,
},
}
</script>
<style lang="stylus">
.md-example-child-progress
display flex
justify-content center
.md-progress
margin 0 10px
.progress-value
font-size 24px
font-family DINPro-Medium
</style>
API
Progress Props
属性 | 说明 | 类型 | 默认值 | 备注 |
---|---|---|---|---|
value | 进度值 | Number | 0 | 0-1 |
size | 圆环大小 | Number | 70 | 单位px |
width | 圆环宽度 | Number | - | 单位px |
color | 圆环高亮颜色 | String | #fc9153 | - |
border-color | 圆环颜色 | String | rgba(0, 0, 0, .1) | - |
fill | 圆环内部填充 | String | transparent | - |
linecap | 圆环两端形状 | String | round | round , butt |
rotate | 圆环旋转 | Number | 0 | - |
transition | 进度变化是否使用动效 | Boolean | false | - |
duration | 进度变化动效时长 | Number | 1000 | 单位ms |
Progress Slots
default
圆环内部内容插槽,一般用于添加文本
defs
圆环SVG内部的插槽,一般用于添加defs
, use
元素等