Dmi*_*dov 3 node.js express pug
我有一个名为的设置页面posting.pug,它是extends一个哈巴狗settingsLayout模板。我的应用程序中有几个设置页面。我想将一个变量传递 posting=1到settingsLayout页面以向用户显示发布页面是当前页面。
我应该如何将变量传递给我扩展的模板?
我之前尝试设置一个变量extends。这是不允许的。
我尝试将它作为属性传递 - 不起作用。
小智 8
你可以这样尝试
设置布局.pug
block variables
doctype html
html
head
body
// Try to call variable here
h1 posting
Run Code Online (Sandbox Code Playgroud)
发帖.pug
extends settingsLayout
block variables
- var posting = 1
Run Code Online (Sandbox Code Playgroud)
我希望这能成功!