jason数据如图一我想循环输出到页面box类下的ul里<div class="box"> <ul class="lh" style="display:block;"> <li> <div class="p-img"><a href="#"><img src="img/4.jpg"></a></div> <div class="p-name"><a href="#">艾家纺全棉</a></div> <div class="p-price"><strong>¥399.00</strong> <div class="p-bt"><a class="reduce" >-</a><input type="text" value="1" class="num"/><a class="plus">+</a></div> </div> </li> <li> <div class="p-img ld"><a href="#"><img src="img/5.png"></a></div> <div class="p-name"><a href="#">优曼真丝提花奢华四件套</a></div> <div class="p-price"><strong>¥1299.00</strong> <div class="p-bt"><a class="reduce">-</a><input type="text" value="1" class="num"/><a class="plus">+</a></div> </div> </li> <li> <div class="p-img ld"><a href="#"><img src="img/6.jpg"></a></div> <div class="p-name"><a href="#">优曼真丝提花奢华四件套</a></div> <div class="p-price"><strong>¥1299.00</strong> <div class="p-bt"><a class="reduce" >-</a><input type="text" value="1" class="num"/><a class="plus">+</a></div> </div> </li> <li> <div class="p-img ld"><a href="#"><img src="img/7.jpg"></a></div> <div class="p-name"><a href="#">优曼真丝提花奢华四件套</a></div> <div class="p-price"><strong>¥1299.00</strong> <div class="p-bt"><a class="reduce" >-</a><input type="text" value="1" class="num"/><a class="plus">+</a></div> </div> </li> </ul></div>
data.goodList.each(function(i,_this){
// 在这里拼接
})
还有一种方法使用template.js本回答被网友采纳