axios带一个headers和一个永远记不住的ajax for循环,具体的代码在文章中显示,详细的可以直接看文章内代码。
代码如下:
mui.ajax(url, {
data: JSON.stringify(data),
dataType: 'json',
headers: {
token: getStorage("token"),
"content-Type": 'application/json; charset=utf-8',
},
type: 'post',
timeout: 10000,
async: false,
success: function(data) {});
感觉和我以前写的那种格式更加明了,要加什么参数直接后面怼上去就好了。
for (var i in list) {
var html = ` < div class = "orderInfo-list" > <div class = "orderInfo-list-main"class = "orderOpen" > <div class = "order-con" > <p > ` + i + ` < /p><p><span>`+list[i].length+`</span > $ {
language == "en" ? 'Orders': '订单'
} < /p></div > <div class = "order-desc" > <i class = "iconfont icon-moreunfold" > </i></div > <div class = "order-desc" > <p > <span > ` + orderNum(list[i]) + ` < /span><span>`+i+`</span > </p> <p> <span>`+orderIncome(list[i])+`</span > <span > ` + i + ` < /span> </p > </div> </div > <div class = "order-tail"style = "display:none;" > ` + orderWay(list[i]) + ` < /div> </div > `;
$orderInfo.append(html);
}
如果箱想在循环里面套一个循环,就在写一个方法,把数据放进去,然后再去调用即可。
本文来自投稿,不代表本站立场,如若转载,请注明出处:https://www.ruletree.club/archives/2050/