为PUG中的引导表中的每个记录添加一个删除按钮

时间:2019-02-23 23:01:34

标签: html express pug

我试图为引导表中的每条记录添加一个按钮,我正在使用哈巴犬模板引擎。它似乎标记无效。请帮助

.jumbotron
  h1 User Report
.container
  table.table
    thead
      tr
        th(scope='col') Name
        th(scope='col') Student ID
        th(scope='col') Department
        th(scope='col') Edit
    tbody
    each x,i in info
        tr
          th(scope='row')= x.name
          td= x.studentID
          td= x.dept
          td= input.btn.btn-primary(id='info.id', type='button', value='Delete')

1 个答案:

答案 0 :(得分:0)

如果要将input嵌套在td内,请像这样在input下缩进td

.jumbotron
    h1 User Report
.container
    table.table
        thead
            tr
                th(scope='col') Name
                th(scope='col') Student ID
                th(scope='col') Department
                th(scope='col') Edit
        tbody
          each x,i in info
            tr
                th(scope='row')= x.name
                td= x.studentID
                td= x.dept
                td
                    input.btn.btn-primary(id= info.id, type='button', value='Delete')