VUE 接口返回数据新增属性及值
<script>
async getActivetyData(){
let res = await Axios.post("接口路径")
if(res.data.code == 1){
data.orderList = res.data.orderDeptData
for(var i = 0; i < data.orderList.length; i++){
data.orderList[i].barColor = '#FFB84F'
data.orderList[i].barColor1 = '#3F88E6'
let value = Math.round(data.orderList[i].volunteerCount/data.totalActivity )
let value2 = Math.round(data.orderList[i].peopleNumber/data.totalPerson)
data.orderList[i].percentage = value * 100 + '%'
data.orderList[i].percentage1 = value2 * 100 + '%'
}
}
},
</script>