gpt4 book ai didi

javascript - 将 Node 变量从 Jade 传递到包含的 html?

转载 作者:行者123 更新时间:2023-12-03 05:47:49 24 4
gpt4 key购买 nike

我正在尝试从jade中包含的html文件访问jade变量。例如...

路线:

router.get('/htmltest', function(req, res, next) {
res.render('htmltest', { title: 'HTML TEST' });
});

Jade :

block content
include htmltest.html

htmltest.html:

<p>This is included html #{title}</p>

标题不以 html 形式显示。我想我有一个范围界定问题。关于如何实现这一目标有什么想法吗?

最佳答案

Jade 中以开括号开头的每一行<被视为单个文本字符串。您需要将 htmltest.html 文件更改为...

p This is included html #{title}

关于javascript - 将 Node 变量从 Jade 传递到包含的 html?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40269484/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com