我很抱歉以前是否提出这个问题,但是我找不到这个问题。
基本上,我试图将数据传递到EJS部分中,该数据具有我想要传递给部分中的功能,但显然它似乎不起作用。这是示例。
<html>
<head>
<title><%- title %></title>
</head>
<body>
<%- include ('partials/header',{myFunction}) %>
<div id="content">
<%- content %>
</div>
<% include partials/footer %>
</body>
我也尝试过使用ES5对象文字语法来传递函数,但是它仍然抛出错误提示
Error: Could not find the include file "('partials/header',{myFunction})"
如果有人能在这里指出我在做什么错,我真的很感激。
谢谢!
答案 0 :(得分:0)
我知道了。这是一个愚蠢的错误。我必须删除空白处include ('partials/header',{myFunction})