gpt4 book ai didi

node.js - 如何在node.js中实现jade模板继承

转载 作者:太空宇宙 更新时间:2023-11-03 22:55:48 25 4
gpt4 key购买 nike

我在同一个文件夹中有两个 Jade 模板,就像:

  |__layout.jade
|__content.jade

并且layout.jade是父模板,content.jade将从它继承:所以在layout.jade中:

doctype 5
html(lang="en")
head
title= title
body
block content

content.jade

extends layout

block content
h1 this is frome nested template

但是,当我运行它时,继承不起作用,它只显示父模板的内容

那么我的代码有什么问题吗?

最佳答案

确保在 content.jade 中包含关键字“append”。

extends layout

block append content
h1 this is from nested template

More on this here.

关于node.js - 如何在node.js中实现jade模板继承,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14011484/

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