<!--单行的进度条--> <template> <div class="progress-wrap"> <div class="progress-title" :style="`width:${labelWidth};`">{{data.title}}</div> <div class="progress-point"> <img :src="require('@/assets/images/icon-point.png')" /> </div> <div> <Progress :percentage="data.num/data.max*100" :num="data.num" :color="color1 || defaultColor1" /> </div> </div> </template> <script> import Progress from './Progress' export default { name: 'ProgressBar', props: { data: { type: Object, default: () => { return { title: '标题', num: 50, max: 100 } } }, // 数据 labelWidth: String | Number, // label宽度 color1: String, // 颜色 color2: String }, components: { Progress }, data () { return { defaultColor1: 'linear-gradient(to right, #8f071e, #c0293e, #f85163)', defaultColor2: 'linear-gradient(to right, #0168e8, #0988e8, #13ace8))' } } } </script> <style rel="stylesheet/scss" lang="scss" scoped> @import '../../assets/css/variable.scss'; .progress-wrap{ padding: .025rem .02rem .027rem .05rem; display: flex; justify-content: space-between; align-items: center; } .progress-wrap .progress-title{ text-align: right; color: $progressBarTextColor; font-size: .05rem; padding-top: .01rem; margin-right: .03rem; } .progress-wrap > div:last-child{ margin-top: .03rem; flex:1; } .progress-point{ padding-right: .02rem; } .progress-point img{ width: .03rem; vertical-align: -.005rem; } </style>