gpt4 book ai didi

node.js - 我尝试了一切方法使该模板正常工作,但仍然出现此错误 : Only named blocks and mixins can appear at the top level of an extending template

转载 作者:太空宇宙 更新时间:2023-11-04 00:05:36 25 4
gpt4 key购买 nike

只有命名 block 和 mixins 才能出现在扩展模板的顶层。它杀了我,我不明白为什么这不起作用。我对哈巴狗很陌生,也许我应该使用一种叫做 mixins 的东西。

//layout.pug

doctype html
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
link(rel='stylesheet', href='https://www.w3schools.com/w3css/4/w3.css')
script(src="https://cdn.auth0.com/js/auth0/8.7/auth0.min.js")
link(href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css',rel='stylesheet')
script(src='https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js')
script(src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js')
body
nav.w3-bar.w3-border.w3-light-grey( role="navigation" )

if loggedIn
a(href="/getposts").w3-bar-item.w3-button All Customers
a(href="/gethotposts" ).w3-bar-item.w3-button HOT Customers
a(id="qsLogoutBtn" href="/logout").w3-bar-item.w3-button Logout
else
a(id="qsLoginBtn" href="/login").w3-bar-item.w3-button Login
a(href="/getposts").w3-bar-item.w3-button All Customers
a(href="/gethotposts" ).w3-bar-item.w3-button HOT Customers

block content
<小时/>
//customers.pug

extends layout

block content
table.table.table-striped(style='width:700px')(align='center')
thead
tr
th First Name
th Last Name
th Email
th Status
tbody
each value in customer
tr
td=value.First_Name
td=value.Last_Name
td=value.Email
td=value.Status

最佳答案

当我很匆忙并且没有仔细检查缩进时,这种情况经常发生在我身上。

block content
table.table.table-striped(style='width:700px')(align='center')

您需要将标签再缩进两个空格,以便位于 block 内容下方,而不是与它一起缩进:

extends layout

block content
table.table.table-striped(style='width:700px')(align='center')
thead
tr
th First Name
th Last Name
th Email
th Status
tbody
each value in customer
tr
td=value.First_Name
td=value.Last_Name
td=value.Email
td=value.Status

关于node.js - 我尝试了一切方法使该模板正常工作,但仍然出现此错误 : Only named blocks and mixins can appear at the top level of an extending template,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52444353/

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