var sku = new Array();
for (var i=0;i<skus.length;i++)
{
sku+="sku['"+skus[i]['goods_attr']+"']='"+skus[i]['product_number']+"';";
}
console.log(JSON.stringify(sku)); //打印成功
//在页面中无法使用
var sku = new Object;
sku['11977|3599'] ='174';
sku['11977|3601'] ='42';
sku['11977|3598'] ='140';
sku['11977|3600'] ='140';
sku['8605|3600'] ='144';
sku['8605|3598'] ='52';
sku['8605|3599'] ='138';
sku['8605|3601'] ='3';
sku['8603|3600'] ='153';
sku['8603|3599'] ='199';
sku['8603|3598'] ='111';
sku['8603|3601'] ='0';
sku['8602|3600'] ='209';
sku['8602|3599'] ='254';
sku['8602|3598'] ='172';
sku['8602|3601'] ='103';
sku['77985|3600'] ='0';
sku['77985|3599'] ='0';
sku['77985|3598'] ='0';
//打印数据结果
直接贴结果在JS里就可以使用 好奇怪
mui("#atts_"+attr).on('tap','li',function(){
var attr_id = this.getAttribute("data-sd");
var color_id =this.getAttribute("data-id");
var key = color_id + '|' + attr_id;
if(sku[key] && sku[key] >0)
{
this.classList.remove("gray");
}
}
);
0 个回复