发表于: 2021-04-18 22:14:25

1 1167


今天完成的事情:

修改传递的数据


将数字改为字符串显示出来

                    // 设置type的对象
                    var objType = { 0: '首页'1: '职位'2: '精英',3: '行业' };
                    console.log(Object(objType));

                    // 设置status的对象
                    var objStatus = { 1: '上线'2: '草稿'};


引入对象

list[i].type

修改为

objType[list[i].type]


完成修改的列表

                    var templte = ""
                    for (let i = 0i < list.lengthi++) {
                        templte = templte +
                            "<tr>" +
                            "<td>" + list[i].id + "</td>" +
                            "<td>" + list[i].title + "</td>" +
                            "<td>" + objType[list[i].type] + "</td>" +
                            "<td>" + list[i].createAt + "</td>" +
                            "<td>" + list[i].updateAt + "</td>" +
                            "<td>" + list[i].author + "</td>" +
                            "<td>" + objStatus[list[i].status] + "</td>" +
                            "<td>" + "<a>" + "上线" + "</a>" + "<a>" + "编辑" + "</a>" + "<a>" + "删除" + "</a>" + "</td>" +
                            "</tr>";

                        console.log(list[i]);
                        // console.log(list[i].status);
                    }
                    $('#tab').append(templte);


做任务7的样式

                    <div class="last">
                        <div>
                            <span>每页显示</span>
                            <input type="number" value="10" min='0'>
                            <span></span>
                        </div>

                        <div>
                            <button>首页</button>
                            <button>末页</button>
                        </div>

css:

        .last {
            displayflex;
            justify-contentflex-end;
            align-itemscenter;
            margin5rem;
            height3rem;
            line-height3rem;
            background-coloryellowgreen;
        }

        .last div {
            margin0 1rem;
            displayflex;
            justify-contentspace-between;
        }

        .last input {
            border-radius0;
            width5rem;
            text-aligncenter;
            vertical-alignmiddle;
        }

        .last button {
            border-radius0;
            width5rem;
            height3rem;
        }

        .last button {
            colorblue;
        }


问题:

列表的时间不知道怎么设置


返回列表 返回列表
评论

    分享到