1.。后台返回的数据格式是下图这样的,然后取name和commonCount
2.把这个数组遍历一下,把要取的name和commonCount放到两个空数组里
这样就取到了
export default {
name: 'ranking',
data(){
return {
}
},
methods:{
// 工作质态--警情排名
queryRanking() {
let this_ = this;
this_.$post("这里面放接口", {}).then(res => {
if (res.code == 200) {
//遍历数组,取出数据
var rankName=[],commonCount=[]
for(var i=0;i