Jade - 如何使用复选框创建 table

Jade - How to create table with checkbox


如何在 jade 模板中创建此代码?

<table>
<tr>
  <th>#</th>
  <th><input type="checkbox"></th>
  <th>User</th>
</tr>
<tr>
  <td>1</td>
  <td><input type="checkbox"></td>
  <td>haacki47</td>
</tr>

我使用编译器gulp-jade
我尝试使用

each val in ["#","<input type='checkbox'>","User"]

但是我收到错误:=(

多维数组应该可以解决您的问题? 另外,与其在数据中传递 HTML,不如在 Jade

中处理它更好
- var datas = [
-   {
-     index: "#",
-     input: "checkbox",
-     name: "user"
-   },
-   {
-     index: "1",
-     input: "checkbox",
-     name: "haacki47"
-   }
- ];

table
  each data in datas
    tr
      td=data.index
      td
        case data.input
          when "checkbox"
            input(type="checkbox")
      td=data.name

密码本:http://codepen.io/Pototo/pen/mVeRwm