——~~~~ 没有最熟练只有更熟练
var benchInfo = new Vue({
el:"body",
data:{
arcount:'',
crcount:'',
},
method:{}
});
api.workBench.wbinfo(tools.getCookie('key'),tools.getCookie('cid'), function (data) {
benchInfo.infolist = data.datas;
for(var item in data.datas[0]){//→看这里## item为key,后面为object ##
var a = data.datas[0];
console.log(item+"--"+a[item]);//→## a[item]为值 ##
}
console.log(data.datas[0]);
var infolist = data.datas[0];
benchInfo.crcount = infolist.crcount;
benchInfo.arcount = infolist.arcount;
})
获取cookie某值
tools.getCookie = function (name) {
var strcookie = document.cookie;//
var arrcookie = strcookie.split("; ");//我之前很熟悉的字符串处理 split()
for (var i = 0; i < arrcookie.length; i++) {
var arr = arrcookie[i].split("=");
if (arr[0] == name) {
return decodeURIComponent((arr[1])) ;
}
}
return "";
};