繁体   English   中英

Jade无法正常工作,未显示index.jade内容

[英]Jade is not working as expected not showing index.jade content

我正在尝试使用玉石。我正在尝试在get请求中呈现模板,我的代码是

app.get('/promocode/generate-promocode',mw.authenticate,function(req,res)
    {  res.render('index1', {}); 
  });

我的layout.jade文件代码是

doctype 5
html
  head
    block head
    title= title

    include layout/css
    include layout/headerjs

    body
      include header/main

      include layout/topbar

      .middle-content
        .container
          .wrapper
            block content

      include footer/main

      include layout/footerjs

我的index.jade文件代码是

extends layout

h1 Welcome to Marketplace 
h1 Welcome to Marketplace 
h1 Welcome to Marketplace 

h1 Welcome to Marketplace 

h1 Welcome to Marketplace 

h1 Welcome to Marketplace 

当我转到页面时,它仅显示layout.jade语法,无h1标题,内容为“ Welcome to Marketplace”。 任何建议如何在html页面中显示此标题标记?

您必须在index.jade中定义必须继承的同一块。

extends layout
block content
  h1 Welcome to Marketplace 

考虑到res.render('index1', {});中文件名的不匹配res.render('index1', {}); 和您index.jade作错字,这应该可以解决您的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM