layui数据表格偶数行背景颜色

,limits:[10,20,30,40,50,60,70,80,90],
done: function (res, curr, count) {// 表格渲染完成之后的回调
    var that = this.elem.next();
    res.data.forEach(function (item, index) {
        //console.log(item.empName);item表示每列显示的数据
        if (index % 2 == 0) {
            var tr = that.find(".layui-table-box tbody tr[data-index='" + index + "']").css("background-color", "#fff");
        } else {
            var tr = that.find(".layui-table-box tbody tr[data-index='" + index + "']").css("background-color", "#f7f7f7");
        }
    });
}})

猜你喜欢

转载自blog.csdn.net/Guoyu1_/article/details/89133825
今日推荐