1. 程式人生 > 其它 >迴圈遍歷,根據條件給頁面渲染值,layui,jq

迴圈遍歷,根據條件給頁面渲染值,layui,jq

迴圈遍歷,根據條件給頁面渲染值

for (var index in res.data) {
    var item=res.data[index];
    if (item.LastFollowDay<0) {

        $("tr[data-index='" + index + "']").attr({"style":"color:red","font-weigth":"bold"})

    }else if(item.Status!="有效"
){ $("tr[data-index='" + index + "']").attr({"style":"color:gray","font-weigth":"bold"}) } else if(item.Status=="預計有效"){ $("tr[data-index='" + index + "']").attr({"style":"color:black"
,"font-weigth":"bold"}) }

}在這裡插入圖片描述