![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/ba305f7d54705b59abec2414506bdf99.png)
<div class="barBox">
<div class="colorBar" v-if="tabType=='bug'" :style="{width:computedBug(itemData,'finish')}"></div>
<div class="colorBar" v-else :style="{width:computedWidth(itemData.estimate)}"></div>
</div>
methods:{
computedBug(item,type) {
if (type == 'finish') {
return parseInt(Number(item.finished) / Number(item.total) * 100) + '%';
}else{
return parseInt(Number(item.delay) / Number(item.total) * 100) + '%';
}
},
}
样式
colorBar: {
//第一种写法
background: linear-gradient(to left, #15473F, #09866D);
// 第二种写法
background: linear-gradient(90deg, #15473F 0%, #09866D 100%);
width: 1px;
height:10px;
}