【发布时间】:2016-04-09 21:17:06
【问题描述】:
我正在学习如何构建简单的 CRUD Web 应用程序,并且指令是用 ejs 编写的。不过我刚开始学jade,不知道怎么把这个ejs代码转成jade。
<% layout( 'layout' ) -%>
<h1 id="page-title"><%= title %></h1>
<div id="list">
<form action="/create" method="post" accept-charset="utf-8">
<div class="item-new">
<input class="input" type="text" name="content" />
</div>
</form>
<% todos.forEach( function ( todo ){ %>
<div class="item">
<a class="update-link" href="/edit/<%= todo._id %>" title="Update this todo item"><%= todo.content %></a>
<a class="del-btn" href="/destroy/<%= todo._id %>" title="Delete this todo item">Delete</a>
</div>
<% }); %>
</div>
这就是我所做的,
extends layout
h1#page-title= title
#list
form(action="/create" method="post" accept-charset='utf-8')
.item-new
input(type='text' name='content')
【问题讨论】: