簡體   English   中英

什么!在玉/哈巴狗做什么?

[英]What does != do in jade/pug?

怎么做!=在下面的玉代碼中工作.. != messages()

extends layout

block content
 .spacer
 .container
  .row
   .col-lg-8.col-lg-offset-2.col-md-10.col-md-offset-1
    a(class='btn btn-tiny btn-primary' href='/manage/categories/add') Create Category
    h1= title
     small
      a(href='/manage/articles')  Manage Articles
    != messages()
    table(class='table table-striped')
     tr
      th Category Title
      th
     each category, i in categories
      tr
       td #{category.title}
       td 
        a(class="btn btn-tiny btn-default" href="/manage/categories/edit/#{category._id}") Edit

app.js

app.use(require('connect-flash')());
app.use(function (req, res, next) {
  res.locals.messages = require('express-messages')(req, res);
  next();
});

它被稱為“插值”。

這意味着“messages()”被轉義,例如,如果您有以下代碼:

var randomText = '<p> this is a <strong>text</strong></p>'
p= randomText

通常,未轉義的,產生的就是它:

'<p> this is a <strong>text</strong></p>'

但如果我打字:

p!= randomText

它實際上會成為ap標簽,看起來完全像這樣:

這是一篇文章

希望它可以幫助你:-)

您可以在文檔中閱讀更多信息,請訪問: https//pugjs.org/language/interpolation.html

你應該試試

if(!messages())
 table(class='table table-striped')

你必須在左側分配一些值。 否則只是驗證if條件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM