我有这个代码,我想从循环插入数据但是我得到错误未捕获TypeError:非法调用 window.items ='';
_.forEach(cart.items, function(n, key) {
var settings = {
"async": true,
"crossDomain": true,
"url": "myurl",
"method": "POST",
"headers": {
"content-type": "application/x-www-form-urlencoded",
"x-csrf-token": user_token,
"cache-control": "no-cache"
},
"data": {
"order_id": order,
"type": "product",
"commerce_product": n.id,
"quantity": n.cant
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});
total = total + (n.cant * n.price)
items += '<li>'
items += '<img src="'+n.img+'" />'
items += '<h3 class="name">'+n.name+'<br><span class="price">'+n.cant+' x '+n.price+' </span>'
});
答案 0 :(得分:0)
panelBus: new Vue()
比用户值