我试图使用翡翠。我试图渲染一个模板在get请求我的代码是
app.get('/promocode/generate-promocode',mw.authenticate,function(req,res)
{ res.render('index1', {});
});
我的布局。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
和我的索引。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
当我进入页面时,它只显示布局。没有h1标题,内容是"欢迎来到市场"。任何建议如何显示这个标题标签在HTML页面??
您必须在索引中定义相同的块。玉石必须继承。
extends layout
block content
h1 Welcome to Marketplace
考虑到res.render('index1', {});
和index.jade
的文件名不匹配,这应该可以解决您的问题。