我正在使用<% include components/aside.ejs %>或<% include components/head.ejs %>在我的代码中的某个地方没有任何问题。但是当我include在这样的 for 循环中使用时
<%
for (var i = 0; i < 20; i++) {
include components/head.ejs;
}
%>
Run Code Online (Sandbox Code Playgroud)
,我明白了Unexpected identifier in [file path] while compiling ejs。
是否有任何我没有注意到的明显错误?
Ste*_*lia 12
要解决重大更改,因为EJS 3.X的,对于语法包括已经从去<%- include components/head.ejs %>到<%- include('components/head.ejs'); %>。
小智 0
在每一行中包含模板标签<%和%>,如下所示:
<% for (var i = 0; i < 20; i++){ %>
<%- include components/head.ejs %>
<% }; %>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5839 次 |
| 最近记录: |