Jade模板引擎无法将<p>标签添加到div的内部

无法将“p”标签添加到div的内部。 这是我的代码:

!!! html head title= title link(rel='stylesheet', href='/stylesheets/#{stylesheet}.css') link(rel='stylesheet', href='/stylesheets/bootstrap.min.css') body .container .row .col-md-4 .col-md-4 .well - if (error) p= error form(role='form',action='sessions', method='post') .form-group label(for='Email') Eposta Adresi input#Email.form-control(type='email',name='user[email]',placeholder='E-posta adresi') .form-group label(for='Password') Şifre input#Password.form-control(type='password',name='user[password]', placeholder='Şifre') button.btn.btn-default(type='submit') Giriş script(type='text/javascript', src='/javascripts/jquery-1.10.2.min.js') script(type='text/javascript', src='/javascripts/bootstrap.min.js') 

它呈现如下:

 <html> <head> <title>Giriş</title> <link rel="stylesheet" href="/stylesheets/login.css"> <link rel="stylesheet" href="/stylesheets/bootstrap.min.css"> </head> <body style="" cz-shortcut-listen="true"> <div class="container"> <div class="row"> <div class="col-md-4"></div> <div class="col-md-4"> <div class="well"></div> </div> </div> </div> <script type="text/javascript" src="/javascripts/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="/javascripts/bootstrap.min.js"></script> </body> </html> 

这发生后,我补充说:

 - if (error) p= error 

所以你希望if语句直接构build成jade,而不是一个javascript代码块(没有领先的破折号)

 .well if error p= error form .form-group.....etc 

你可能也想减lessform标签和下面的所有内容的缩进1级我会想,但这取决于你想要什么样的行为,当有一个错误。