父模板
<!doctype html>
<html lang="zh-CN">
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
{% block stylesheets %}
<link rel="stylesheet" href="../css/sytle.css">
{% endblock %}
{#{% block title %}
测试继承
{% endblock %}#}
</head>
<body>
{% block body %}
{% endblock %}
{% block script %}
{% endblock %}
</body>
</html>
子模板:
{% extends './layouts/layou.nunjs' %}
{% block title %}
<title>首页</title>
<link rel="stylesheet" href="../css/style.css">
{% endblock %}
{% block body %}
<div class="head">
{% include './layouts/head.nunjs' %}
</div>
{% for ingredient, amount in food %}
<p>Use {{ amount }} of {{ ingredient }}</p>
{% endfor %}
{% endblock %}
在访问子模板时,继承的父模板中请求的css和js并不能成功请求到。Chrome中提示的是:
Faild to load response data。
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…