Progress 进度条 APP
该方法或组件支持移动端小程序调用
PC
该方法或组件支持桌面端小程序调用

表明某个任务的当前进度。

规则

  • 在操作需要较长时间才能完成时,为用户显示该操作的当前进度和状态。
  • 和 NavBar 一起搭配使用时,可以隐藏 Progress 未填充部分的轨道,提升整体感。

引入方式

数字生活小程序工程中,不需要 import,直接使用组件标签即可。

import {Progress} from '@21cnfe/vui'  
Vue.component('Progress', Progress)

代码演示

条形进度条 通过设置type=bar使用,能够设置进度、位置、样式以及展现方式
//默认位置,position:fixed置顶
<Progress :percent="20" />
//进入文档流,position:normal
<Progress type="bar" :percent="50" position="normal" />
//隐藏未填充部分
<Progress type="bar" :percent="40" position="normal" :unfilled="false" />
//自定义样式
<template>
<Progress type="bar" :percent="40" position="normal" :barStyle="barStyle" :backStyle="backStyle"/>
</template>
<script>
export default {
data () {
return {
barStyle: {
'background': '#ff5b05'
},
backStyle: {
'background': '#13C2C2'
}
}
}
}
</script>
环形进度条 通过设置type=circle使用,能够设置进度以及自定义样式
//默认样式
<Progress type="circle" :percent="25" />
//插入图片
<Progress type="circle" :percent="75" :circleImg="circleImg" />
//插入图标
<Progress type="circle" :percent="100" :circleIcon="circleIcon" />
//自定义样式
<template>
<Progress type="circle" :percent="25" :circleStyle="circleStyle" @click="handleClick" />
</template>
<script>
export default {
data () {
return {
circleImg: 'https://zos.alipayobjects.com/rmsportal/sifuoDUQdAFKAVcFGROC.svg',
circleIcon: {
type: 'check'
},
circleStyle: {
'borderSize': '10px',
'borderColor': 'red',
'backColor': 'blue',
'circleSize': '80px',
'msgColor': 'red'
}
}
},
methods: {
handleClick () {
console.log('click')
}
}
}
</script>

API

属性 说明 类型 默认值
percent 进度百分比 Number 0
type 进度条类型; 可选值:circlebar String circle
position 进度条的位置,fixed 将浮出固定在最顶层,可选值:fixednormal String fixed
unfilled 是否显示未填充的轨道 Boolean true
barStyle 条形进度条已填充样式 Object {}
backStyle 条形进度条未填充样式 Object {}
circleStyle 环形进度条样式 Object {}
msgBackground 环形进度条背景色 String #FFFFFF
  1. 1. Progress 进度条 APP 该方法或组件支持移动端小程序调用 PC 该方法或组件支持桌面端小程序调用
    1. 1.1. 规则
    2. 1.2. 引入方式
    3. 1.3. 代码演示
    4. 1.4. API